Extract explaining variable and move work outside the transaction constraint
This commit is contained in:
@@ -12,9 +12,11 @@ module Bubble::Assignable
|
||||
end
|
||||
|
||||
def assign(users, assigner: Current.user)
|
||||
assignee_rows = Array(users).collect { |user| { assignee_id: user.id, assigner_id: assigner.id, bubble_id: id } }
|
||||
|
||||
transaction do
|
||||
Assignment.insert_all Array(users).collect { |user| { assignee_id: user.id, assigner_id: assigner.id, bubble_id: id } }
|
||||
track_event :assigned, assignee_ids: Array(users).map(&:id)
|
||||
Assignment.insert_all assignee_rows
|
||||
track_event :assigned, assignee_ids: assignee_rows.pluck(:assignee_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user