mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-08 07:55:14 +08:00
Merge pull request #723 from ZmagoD/zd_SCI_1408
Fixes bugs on canvas [fixes SCI-1408]
This commit is contained in:
commit
5f4006fe4a
2 changed files with 6 additions and 8 deletions
|
@ -761,8 +761,6 @@ class Experiment < ApplicationRecord
|
|||
workflows = []
|
||||
dg.to_undirected.each_connected_component { |w| workflows << w }
|
||||
|
||||
# Retrieve maximum allowed module group name
|
||||
max_length = (MyModuleGroup.validators_on(:name).select { |v| v.class == ActiveModel::Validations::LengthValidator }).first.options[:maximum]
|
||||
# For each workflow, generate new names
|
||||
new_index = 1
|
||||
wf_names = []
|
||||
|
@ -788,16 +786,16 @@ class Experiment < ApplicationRecord
|
|||
name = I18n.t("my_module_groups.new.name", index: new_index)
|
||||
new_index += 1
|
||||
end
|
||||
elsif name.length > max_length
|
||||
elsif name.length > Constants::NAME_MAX_LENGTH
|
||||
# If length is too long, shorten it
|
||||
name = name[0..(max_length + cut_index)] + suffix
|
||||
name = name[0..(Constants::NAME_MAX_LENGTH + cut_index)] + suffix
|
||||
end
|
||||
|
||||
wf_names << name
|
||||
end
|
||||
|
||||
# Remove any existing module groups from modules
|
||||
unless MyModuleGroup.destroy_all(:id => group_ids.to_a)
|
||||
unless MyModuleGroup.where(id: group_ids.to_a).destroy_all
|
||||
raise ActiveRecord::ActiveRecordError
|
||||
end
|
||||
|
||||
|
|
|
@ -135,10 +135,10 @@ class MyModule < ApplicationRecord
|
|||
MyModule.transaction do
|
||||
archived = super
|
||||
# Unassociate all samples from module.
|
||||
archived = SampleMyModule.destroy_all(:my_module => self) if archived
|
||||
archived = SampleMyModule.where(my_module: self).destroy_all if archived
|
||||
# Remove all connection between modules.
|
||||
archived = Connection.delete_all(:input_id => id) if archived
|
||||
archived = Connection.delete_all(:output_id => id) if archived
|
||||
archived = Connection.where(input_id: id).delete_all if archived
|
||||
archived = Connection.where(output_id: id).delete_all if archived
|
||||
unless archived
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue