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
refactor: improve method names
Christophe Bliardd08d8ee3f1ee
diff --git a/app/services/work_packages/set_attributes_service.rb b/app/services/work_packages/set_attributes_service.rbindex 33687b6d6b3..ff145431eba 100644--- a/app/services/work_packages/set_attributes_service.rb+++ b/app/services/work_packages/set_attributes_service.rb@@ -70,8 +70,8 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesupdate_datesendshift_dates_to_soonest_working_days- update_duration- update_derivable+ update_duration_to_one_day_for_milestones+ update_derivable_date_attributeupdate_progress_attributesupdate_project_dependent_attributesreassign_invalid_status_if_type_changed@@ -79,8 +79,8 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesset_cause_for_readonly_attributesend- def derivable_attribute- derivable_attribute_by_others_presence || derivable_attribute_by_others_absence+ def derivable_date_attribute+ derivable_date_attribute_by_others_presence || derivable_date_attribute_by_others_absenceend# Returns a field derivable by the presence of the two others, or +nil+ if@@ -91,7 +91,7 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributes## If +ignore_non_working_days+ has been changed, try deriving +due_date+ and# +start_date+ before +duration+.- def derivable_attribute_by_others_presence+ def derivable_date_attribute_by_others_presencefields =if work_package.ignore_non_working_days_changed?%i[due_date start_date duration]@@ -116,7 +116,7 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributes## Matching is done in the order :duration, :due_date, :start_date. The first# one to match is returned.- def derivable_attribute_by_others_absence+ def derivable_date_attribute_by_others_absence%i[duration due_date start_date].find { |field| derivable_by_others_absence?(field) }end@@ -145,8 +145,8 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesend# rubocop:disable Metrics/AbcSize- def update_derivable- case derivable_attribute+ def update_derivable_date_attribute+ case derivable_date_attributewhen :durationwork_package.duration =if work_package.milestone?@@ -320,7 +320,7 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributeswork_package.due_date = days.soonest_working_day(work_package.due_date)end- def update_duration+ def update_duration_to_one_day_for_milestoneswork_package.duration = 1 if work_package.milestone?end@@ -365,7 +365,7 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesavailable_types = work_package.project.types.order(:position)work_package.type = available_types.first- update_duration+ update_duration_to_one_day_for_milestonesunify_milestone_datesreassign_status assignable_statuses@@ -470,14 +470,14 @@ class WorkPackages::SetAttributesService < BaseServices::SetAttributesstart = work_package.parent&.start_datedue = work_package.due_date || work_package.parent&.due_date- (start && !due) || ((due && start) && (start < due))+ (start && !due) || (due && start && (start < due))enddef parent_due_later_than_start?due = work_package.parent&.due_datestart = work_package.start_date || work_package.parent&.start_date- (due && !start) || ((due && start) && (due > start))+ (due && !start) || (due && start && (due > start))enddef set_cause_for_readonly_attributes