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

Make seeding aware of non-working days for BIM edition

Christophe Bliard2ae6edd66d38
diff --git a/app/seeders/demo_data/work_package_seeder.rb b/app/seeders/demo_data/work_package_seeder.rb
index 997692f0228..947ac7d6f75 100644
--- a/app/seeders/demo_data/work_package_seeder.rb
+++ b/app/seeders/demo_data/work_package_seeder.rb
@@ -146,7 +146,11 @@ module DemoData
end
def set_time_tracking_attributes!(wp_attr, attributes)
- wp_attr.merge!(TimeTrackingAttributes.for(attributes))
+ wp_attr.merge!(time_tracking_attributes(attributes))
+ end
+
+ def time_tracking_attributes(attributes)
+ TimeTrackingAttributes.for(attributes)
end
def set_backlogs_attributes!(wp_attr, attributes)
diff --git a/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rb b/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rb
index b44e4c61dda..27f562dfa50 100644
--- a/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rb
+++ b/modules/bim/lib/open_project/bim/patches/work_package_seeder_patch.rb
@@ -7,17 +7,16 @@ module OpenProject::Bim::Patches::WorkPackageSeederPatch
def create_or_update_work_package(attributes)
uuid = attributes[:bcf_issue_uuid]
if uuid
-
- start_date = calculate_start_date(attributes[:start])
- due_date = calculate_due_date(start_date, attributes[:duration])
+ time_tracking_attributes = time_tracking_attributes(attributes)
work_package = find_bcf_issue(uuid)
-
work_package.update_columns(created_at: Time.now,
author_id: user.id,
assigned_to_id: find_assignee_id(attributes[:assigned_to]),
- start_date:,
- due_date:)
+ start_date: time_tracking_attributes[:start_date],
+ due_date: time_tracking_attributes[:due_date],
+ duration: time_tracking_attributes[:duration],
+ ignore_non_working_days: time_tracking_attributes[:ignore_non_working_days])
update_parent(work_package, attributes)
else