Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Allow for seeding project parent child hierarchies

Wieland Lindenthal8c84ddbc546d
diff --git a/app/seeders/demo_data/project_seeder.rb b/app/seeders/demo_data/project_seeder.rb
index ef574900149..cee28cb8d00 100644
--- a/app/seeders/demo_data/project_seeder.rb
+++ b/app/seeders/demo_data/project_seeder.rb
@@ -188,10 +188,22 @@ module DemoData
identifier: project_identifier(key),
description: project_description(key),
enabled_module_names: project_modules(key),
- types: project_types
+ types: project_types,
+ parent_id: parent_project_id(key)
}
end
+ def parent_project_id(key)
+ parent_project(key).try(:id)
+ end
+
+ def parent_project(key)
+ identifier = project_data_for(key, 'parent')
+ return nil unless identifier.present?
+
+ Project.find_by(identifier: identifier)
+ end
+
def project_name(key)
project_data_for(key, 'name')
end