Fix changing protocol ownership logic when removing user from the team [SCI-1415]

This commit is contained in:
Oleksii Kriuchykhin 2017-06-26 15:30:18 +02:00
parent d726c121bc
commit f2f57de264

View file

@ -59,8 +59,8 @@ class UserTeam < ActiveRecord::Base
end
# Also, make new owner author of all protocols that belong
# to the departing user.
p_ids = user.added_protocols.pluck(:id)
# to the departing user and belong to this team.
p_ids = user.added_protocols.where(team: team).pluck(:id)
Protocol.find(p_ids).each do |protocol|
protocol.record_timestamps = false
protocol.added_by = new_owner