|
|
@ -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 |
|
|
|