Search for related WP primarily in the same project

pull/7493/head
Henriette Dinger 5 years ago
parent 5e4ec13e3b
commit e2cf82c71b
  1. 7
      app/seeders/demo_data/work_package_seeder.rb

@ -161,9 +161,12 @@ module DemoData
def create_relations(attributes) def create_relations(attributes)
Array(attributes[:relations]).each do |relation| Array(attributes[:relations]).each do |relation|
root_work_package = WorkPackage.find_by!(subject: attributes[:subject])
to_work_package = WorkPackage.find_by(subject: relation[:to], project: root_work_package.project)
to_work_package = WorkPackage.find_by!(subject: relation[:to]) unless to_work_package.nil?
create_relation( create_relation(
to: WorkPackage.find_by!(subject: relation[:to]), to: to_work_package,
from: WorkPackage.find_by!(subject: attributes[:subject]), from: root_work_package,
type: relation[:type] type: relation[:type]
) )
end end

Loading…
Cancel
Save