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
Set the duration by setting the attribute not as a callback in order to avoid having a dirty duration attribute.
Dombi Attila0bd41c3780da
diff --git a/spec/factories/project_phase_factory.rb b/spec/factories/project_phase_factory.rbindex d0734566ded..231c29ef2a7 100644--- a/spec/factories/project_phase_factory.rb+++ b/spec/factories/project_phase_factory.rb@@ -36,13 +36,7 @@ FactoryBot.define dostart_date { Date.current - 2.days }finish_date { Date.current + 2.days }-- # calculate duration by diffing start and finish dates unless duration is set explicitly- callback(:after_build, :after_stub) do |phase, context|- next if context.__override_names__.include?(:duration)-- phase.duration = phase.range_set? ? phase.finish_date - phase.start_date + 1 : nil- end+ duration { range_set? ? finish_date - start_date + 1 : nil }trait :skip_validate doto_create { |instance| instance.save(validate: false) }