mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
Merge pull request #1615 from jbargu/jg_sci_3252
Change breadcrumbs for copy as template experiment, missing activity for move workflow [SCI-3252]
This commit is contained in:
commit
111b0e2b7f
2 changed files with 19 additions and 4 deletions
|
@ -210,7 +210,7 @@ class Experiment < ApplicationRecord
|
|||
move_modules(updated_to_move, current_user)
|
||||
|
||||
# Everyhing is set, now we can move any module groups
|
||||
move_module_groups(updated_to_move_groups)
|
||||
move_module_groups(updated_to_move_groups, current_user)
|
||||
end
|
||||
rescue ActiveRecord::ActiveRecordError,
|
||||
ArgumentError,
|
||||
|
@ -365,7 +365,7 @@ class Experiment < ApplicationRecord
|
|||
# If a module with given ID doesn't exist (or experiment ID)
|
||||
# it's obviously not updated. Position for entire module group is updated
|
||||
# to bottom left corner.
|
||||
def move_module_groups(to_move)
|
||||
def move_module_groups(to_move, current_user)
|
||||
to_move.each do |ids, experiment_id|
|
||||
modules = my_modules.find(ids)
|
||||
groups = Set.new(modules.map(&:my_module_group))
|
||||
|
@ -391,8 +391,23 @@ class Experiment < ApplicationRecord
|
|||
modules.each { |m| m.y += -curr_min_y + max_y }
|
||||
|
||||
modules.each do |m|
|
||||
experiment_org = m.experiment
|
||||
m.experiment = experiment
|
||||
m.save!
|
||||
|
||||
# Add activity
|
||||
Activities::CreateActivityService.call(
|
||||
activity_type: :move_task,
|
||||
owner: current_user,
|
||||
subject: m,
|
||||
project: experiment.project,
|
||||
team: experiment.project.team,
|
||||
message_items: {
|
||||
my_module: m.id,
|
||||
experiment_original: experiment_org.id,
|
||||
experiment_new: experiment.id
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
group.experiment = experiment
|
||||
|
|
|
@ -90,8 +90,8 @@ module Experiments
|
|||
.call(activity_type: :clone_experiment,
|
||||
owner: @user,
|
||||
team: @project.team,
|
||||
project: @project,
|
||||
subject: @exp,
|
||||
project: @c_exp.project,
|
||||
subject: @c_exp,
|
||||
message_items: { experiment_new: @c_exp.id,
|
||||
experiment_original: @exp.id })
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue