Fixes bugs on canvas [fixes SCI-1408]

This commit is contained in:
zmagod 2017-06-29 10:29:41 +02:00
parent b830be3ec6
commit bef5a085c4
2 changed files with 7 additions and 7 deletions

View file

@ -762,7 +762,7 @@ class Experiment < ApplicationRecord
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]
max_length = Constants::NAME_MAX_LENGTH
# For each workflow, generate new names
new_index = 1
wf_names = []
@ -797,7 +797,7 @@ class Experiment < ApplicationRecord
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

View file

@ -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
@ -285,7 +285,7 @@ class MyModule < ApplicationRecord
if !final.include?(my_module)
final << my_module
end
modules.push(*my_module.my_modules.flatten)
modules.push(*my_module.my_modules)
end
final
end
@ -299,7 +299,7 @@ class MyModule < ApplicationRecord
if !final.include?(my_module)
final << my_module
end
modules.push(*my_module.my_module_antecessors.flatten)
modules.push(*my_module.my_module_antecessors)
end
final
end