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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
dynamic and proper duration in project phase factory
Ivan Kuchin35d22b7b366e
diff --git a/spec/factories/project_phase_factory.rb b/spec/factories/project_phase_factory.rbindex 9c50cff8467..67447f92221 100644--- a/spec/factories/project_phase_factory.rb+++ b/spec/factories/project_phase_factory.rb@@ -36,7 +36,7 @@ FactoryBot.define dostart_date { Date.current - 2.days }finish_date { Date.current + 2.days }- duration { 5 }+ duration { start_date && finish_date ? finish_date - start_date + 1 : nil }trait :skip_validate doto_create { |instance| instance.save(validate: false) }@@ -45,5 +45,10 @@ FactoryBot.define dotrait :with_gated_definition dodefinition { association(:project_phase_definition, :with_start_gate, :with_finish_gate) }end++ # calculate duration taking weekdays and non working days into account+ trait :proper_duration do+ callback(:after_build, :after_stub, &:set_calculated_duration)+ endendend