mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 03:46:39 +08:00
Regenerate user assignments when moving task workflow [SCI-6262] (#3668)
This commit is contained in:
parent
22623c821d
commit
0749fbdf7b
1 changed files with 50 additions and 44 deletions
|
@ -327,6 +327,7 @@ class Experiment < ApplicationRecord
|
|||
# it's obviously not updated. Position for entire module group is updated
|
||||
# to bottom left corner.
|
||||
def move_module_groups(to_move, current_user)
|
||||
ActiveRecord::Base.transaction do
|
||||
to_move.each do |ids, experiment_id|
|
||||
modules = my_modules.find(ids)
|
||||
groups = Set.new(modules.map(&:my_module_group))
|
||||
|
@ -357,6 +358,10 @@ class Experiment < ApplicationRecord
|
|||
m.experiment = experiment
|
||||
m.save!
|
||||
|
||||
# regenerate user assignments
|
||||
m.user_assignments.destroy_all
|
||||
UserAssignments::GenerateUserAssignmentsJob.new(m, current_user).perform_now
|
||||
|
||||
# Add activity
|
||||
Activities::CreateActivityService.call(
|
||||
activity_type: :move_task,
|
||||
|
@ -377,6 +382,7 @@ class Experiment < ApplicationRecord
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Update connections for all modules in this project.
|
||||
# Input is an array of arrays, where first element represents
|
||||
|
|
Loading…
Add table
Reference in a new issue