mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 05:34:55 +08:00
Fixes error when clonning experiments with long names [SCI-617]
This commit is contained in:
parent
213425b493
commit
79efb34191
2 changed files with 5 additions and 6 deletions
|
@ -185,6 +185,8 @@ class ExperimentsController < ApplicationController
|
||||||
cloned_experiment = @experiment.deep_clone_to_project(current_user,
|
cloned_experiment = @experiment.deep_clone_to_project(current_user,
|
||||||
project)
|
project)
|
||||||
success = cloned_experiment.valid?
|
success = cloned_experiment.valid?
|
||||||
|
# Create workflow image
|
||||||
|
cloned_experiment.delay.generate_workflow_img if success
|
||||||
else
|
else
|
||||||
success = false
|
success = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class Experiment < ActiveRecord::Base
|
class Experiment < ActiveRecord::Base
|
||||||
include ArchivableModel, SearchableModel
|
include ArchivableModel
|
||||||
|
include SearchableModel
|
||||||
|
|
||||||
belongs_to :project, inverse_of: :experiments
|
belongs_to :project, inverse_of: :experiments
|
||||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User'
|
||||||
|
@ -354,7 +355,7 @@ class Experiment < ActiveRecord::Base
|
||||||
i += 1 while experiment_names.include?(format(format, i, name))
|
i += 1 while experiment_names.include?(format(format, i, name))
|
||||||
|
|
||||||
clone = Experiment.new(
|
clone = Experiment.new(
|
||||||
name: format(format, i, name),
|
name: format(format, i, name).truncate(Constants::NAME_MAX_LENGTH),
|
||||||
description: description,
|
description: description,
|
||||||
created_by: current_user,
|
created_by: current_user,
|
||||||
last_modified_by: current_user,
|
last_modified_by: current_user,
|
||||||
|
@ -371,10 +372,6 @@ class Experiment < ActiveRecord::Base
|
||||||
m.deep_clone_to_experiment(current_user, clone)
|
m.deep_clone_to_experiment(current_user, clone)
|
||||||
end
|
end
|
||||||
clone.save
|
clone.save
|
||||||
|
|
||||||
# Create workflow image
|
|
||||||
clone.delay.generate_workflow_img
|
|
||||||
|
|
||||||
clone
|
clone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue