Merge pull request #619 from okriuchykhin/ok_SCI_617

Fixes error when cloning experiments with long names [SCI-617]
This commit is contained in:
okriuchykhin 2017-05-12 16:53:38 +02:00 committed by GitHub
commit 8e523782d9
2 changed files with 5 additions and 6 deletions

View file

@ -185,6 +185,8 @@ class ExperimentsController < ApplicationController
cloned_experiment = @experiment.deep_clone_to_project(current_user,
project)
success = cloned_experiment.valid?
# Create workflow image
cloned_experiment.delay.generate_workflow_img if success
else
success = false
end

View file

@ -1,5 +1,6 @@
class Experiment < ActiveRecord::Base
include ArchivableModel, SearchableModel
include ArchivableModel
include SearchableModel
belongs_to :project, inverse_of: :experiments
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))
clone = Experiment.new(
name: format(format, i, name),
name: format(format, i, name).truncate(Constants::NAME_MAX_LENGTH),
description: description,
created_by: current_user,
last_modified_by: current_user,
@ -371,10 +372,6 @@ class Experiment < ActiveRecord::Base
m.deep_clone_to_experiment(current_user, clone)
end
clone.save
# Create workflow image
clone.delay.generate_workflow_img
clone
end