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
Update wording to match the one used in user messages
Christophe Bliardb1dec3931360
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rbindex dfdf56eba60..87c77f50031 100644--- a/app/contracts/work_packages/base_contract.rb+++ b/app/contracts/work_packages/base_contract.rb@@ -59,7 +59,7 @@ module WorkPackages} doif OpenProject::FeatureDecisions.percent_complete_edition_active?validate_percent_complete_matches_work_and_remaining_work- validate_percent_complete_is_unset_when_work_is_zero+ validate_percent_complete_is_empty_when_work_is_zerovalidate_percent_complete_is_set_when_work_and_remaining_work_are_setendend@@ -80,7 +80,7 @@ module WorkPackagesattribute :remaining_hours dovalidate_remaining_work_is_lower_than_workif OpenProject::FeatureDecisions.percent_complete_edition_active?- validate_remaining_work_is_zero_or_unset_when_percent_complete_is_100p+ validate_remaining_work_is_zero_or_empty_when_percent_complete_is_100pvalidate_remaining_work_is_set_when_work_and_percent_complete_are_setelse# to be removed in 15.0 with :percent_complete_edition feature flag removal@@ -363,25 +363,25 @@ module WorkPackagesenddef validate_work_is_set_when_remaining_work_and_percent_complete_are_set- if remaining_work_set_and_valid? && percent_complete_set_and_valid? && work_unset? && percent_complete != 100+ if remaining_work_set_and_valid? && percent_complete_set_and_valid? && work_empty? && percent_complete != 100errors.add(:estimated_hours, :must_be_set_when_remaining_work_and_percent_complete_are_set)endend- def validate_remaining_work_is_zero_or_unset_when_percent_complete_is_100p+ def validate_remaining_work_is_zero_or_empty_when_percent_complete_is_100preturn unless percent_complete == 100if work_set_and_valid? && remaining_work != 0errors.add(:remaining_hours, :must_be_set_to_zero_hours_when_work_is_set_and_percent_complete_is_100p)- elsif work_unset? && remaining_work_set?- errors.add(:remaining_hours, :must_be_unset_when_work_is_unset_and_percent_complete_is_100p)+ elsif work_empty? && remaining_work_set?+ errors.add(:remaining_hours, :must_be_empty_when_work_is_empty_and_percent_complete_is_100p)endenddef validate_remaining_work_is_set_when_work_and_percent_complete_are_setreturn if percent_complete == 100- if work_set_and_valid? && percent_complete_set_and_valid? && remaining_work_unset?+ if work_set_and_valid? && percent_complete_set_and_valid? && remaining_work_empty?errors.add(:remaining_hours, :must_be_set_when_work_and_percent_complete_are_set)endend@@ -389,7 +389,7 @@ module WorkPackagesdef validate_percent_complete_is_set_when_work_and_remaining_work_are_setreturn if remaining_work_exceeds_work? # avoid too many error messages at the same time- if work_set_and_valid? && remaining_work_set_and_valid? && work != 0 && percent_complete_unset?+ if work_set_and_valid? && remaining_work_set_and_valid? && work != 0 && percent_complete_empty?errors.add(:done_ratio, :must_be_set_when_work_and_remaining_work_are_set)endend@@ -402,7 +402,7 @@ module WorkPackagesendend- def validate_percent_complete_is_unset_when_work_is_zero+ def validate_percent_complete_is_empty_when_work_is_zeroreturn if WorkPackage.status_based_mode?if work == 0 && percent_complete_set?@@ -422,7 +422,7 @@ module WorkPackageswork_set? && work >= 0end- def work_unset?+ def work_empty?work.nil?end@@ -438,7 +438,7 @@ module WorkPackagesremaining_work_set? && remaining_work >= 0end- def remaining_work_unset?+ def remaining_work_empty?remaining_work.nil?end@@ -449,7 +449,7 @@ module WorkPackagesenddef remaining_work_exceeds_work?- # if % complete is 100%, then remaining work should be 0h or unset, so no+ # if % complete is 100%, then remaining work should be 0h or empty, so no# need to display an error for remaining work exceeding workreturn false if percent_complete == 100@@ -468,13 +468,13 @@ module WorkPackagespercent_complete_set? && percent_complete.between?(0, 100)end- def percent_complete_unset?+ def percent_complete_empty?percent_complete.nil?enddef percent_complete_derivation_unapplicable?WorkPackage.status_based_mode? || # only applicable in work-based mode- work_unset? || remaining_work_unset? || percent_complete_unset? || # only applicable if all 3 values are set+ work_empty? || remaining_work_empty? || percent_complete_empty? || # only applicable if all 3 values are setwork == 0 || percent_complete == 100 || # only applicable if not in special cases leading to divisions by zeroinvalid_work_or_remaining_work_values? # only applicable if work and remaining work values are validenddiff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rbindex 7e87d9b36fb..229d7ea0518 100644--- a/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb+++ b/app/services/work_packages/set_attributes_service/derive_progress_values_base.rb@@ -55,11 +55,11 @@ class WorkPackages::SetAttributesServicework.present?end- def work_unset?+ def work_empty?work.nil?end- def work_was_unset?+ def work_was_empty?work_package.estimated_hours_was.nil?end@@ -87,11 +87,11 @@ class WorkPackages::SetAttributesServiceremaining_work.present?end- def remaining_work_unset?+ def remaining_work_empty?remaining_work.nil?end- def remaining_work_was_unset?+ def remaining_work_was_empty?work_package.remaining_hours_was.nil?end@@ -119,11 +119,11 @@ class WorkPackages::SetAttributesServicepercent_complete.present?end- def percent_complete_unset?+ def percent_complete_empty?percent_complete.nil?end- def percent_complete_was_unset?+ def percent_complete_was_empty?work_package.done_ratio_was.nil?end@@ -157,7 +157,7 @@ class WorkPackages::SetAttributesServiceenddef remaining_work_from_percent_complete_and_work- return nil if work_unset? || percent_complete_unset?+ return nil if work_empty? || percent_complete_empty?completed_work = work * percent_complete / 100.0remaining_work = (work - completed_work).round(2)diff --git a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rbindex 027e9c3cc05..76ef3cf9a18 100644--- a/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb+++ b/app/services/work_packages/set_attributes_service/derive_progress_values_work_based.rb@@ -67,12 +67,12 @@ class WorkPackages::SetAttributesServiceenddef update_work- return if remaining_work_unset? && percent_complete_unset?+ return if remaining_work_empty? && percent_complete_empty?return if percent_complete == 100 # would be Infinity if computed when % complete is 100%return unless work_can_be_derived?self.work =- if remaining_work_unset?+ if remaining_work_empty?nilelsework_from_percent_complete_and_remaining_work@@ -81,15 +81,15 @@ class WorkPackages::SetAttributesService# rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexitydef update_remaining_work- return if work_unset? && percent_complete_unset?- return if work_was_unset? && remaining_work_set? # remaining work is kept and % complete will be set+ return if work_empty? && percent_complete_empty?+ return if work_was_empty? && remaining_work_set? # remaining work is kept and % complete will be set- if work_set? && remaining_work_unset? && percent_complete_unset?+ if work_set? && remaining_work_empty? && percent_complete_empty?self.remaining_work = workelsif work_changed? && work_set? && remaining_work_set? && percent_complete_not_provided_by_user?delta = work - work_wasself.remaining_work = (remaining_work + delta).clamp(0.0, work)- elsif work_unset? || percent_complete_unset?+ elsif work_empty? || percent_complete_empty?self.remaining_work = nilelseself.remaining_work = remaining_work_from_percent_complete_and_work@@ -98,13 +98,13 @@ class WorkPackages::SetAttributesService# rubocop:enable Metrics/AbcSize,Metrics/PerceivedComplexitydef update_percent_complete- return if work_unset?+ return if work_empty?self.percent_complete = percent_complete_from_work_and_remaining_workenddef percent_complete_from_work_and_remaining_work- return nil if work.zero? || remaining_work_unset?+ return nil if work.zero? || remaining_work_empty?completed_work = work - remaining_workcompletion_ratio = completed_work.to_f / work@@ -122,15 +122,15 @@ class WorkPackages::SetAttributesServiceenddef remaining_work_set_greater_than_work?- (work_was_unset? || remaining_work_came_from_user?) \+ (work_was_empty? || remaining_work_came_from_user?) \&& percent_complete_not_provided_by_user? \&& work && remaining_work && remaining_work > workenddef work_can_be_derived?- work_unset? \+ work_empty? \|| (remaining_work_came_from_user? && percent_complete_came_from_user?) \- || (remaining_work_unset? && remaining_work_came_from_user?)+ || (remaining_work_empty? && remaining_work_came_from_user?)endendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex b5d4509a723..46384005d4a 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1155,7 +1155,7 @@ en:must_be_set_when_work_and_percent_complete_are_set: "required when Work and % Complete are set."must_be_set_to_zero_hours_when_work_is_set_and_percent_complete_is_100p: >-must be 0h when Work is set and % Complete is 100%.- must_be_unset_when_work_is_unset_and_percent_complete_is_100p: >-+ must_be_empty_when_work_is_empty_and_percent_complete_is_100p: >-must be empty when Work is empty and % Complete is 100%.readonly_status: "The work package is in a readonly status so its attributes cannot be changed."type:diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rbindex 0c673e26de2..c89622a048d 100644--- a/spec/contracts/work_packages/base_contract_spec.rb+++ b/spec/contracts/work_packages/base_contract_spec.rb@@ -306,7 +306,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is valid"end- context "when unset while remaining work and % complete are set" do+ context "when empty while remaining work and % complete are set" dolet(:estimated_hours) { nil }let(:remaining_hours) { 2.0 }let(:done_ratio) { 50 }@@ -314,7 +314,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is invalid", estimated_hours: :must_be_set_when_remaining_work_and_percent_complete_are_setend- context "when unset while remaining work is set and % complete is set to an invalid value" do+ context "when empty while remaining work is set and % complete is set to an invalid value" dolet(:estimated_hours) { nil }let(:remaining_hours) { 2.0 }let(:done_ratio) { 200 }@@ -324,7 +324,7 @@ RSpec.describe WorkPackages::BaseContract,done_ratio: :inclusionend- context "when unset while % complete is set and remaining work is set to an invalid value" do+ context "when empty while % complete is set and remaining work is set to an invalid value" dolet(:estimated_hours) { nil }let(:remaining_hours) { -2.0 }let(:done_ratio) { 50 }@@ -415,7 +415,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is valid"end- context "when unset while work and % complete are set" do+ context "when empty while work and % complete are set" dolet(:estimated_hours) { 3 }let(:remaining_hours) { nil }let(:done_ratio) { 50 }@@ -423,7 +423,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is invalid", remaining_hours: :must_be_set_when_work_and_percent_complete_are_setend- context "when unset while work is set and % complete is set to an invalid value" do+ context "when empty while work is set and % complete is set to an invalid value" dolet(:estimated_hours) { 3 }let(:remaining_hours) { nil }let(:done_ratio) { -1 }@@ -433,7 +433,7 @@ RSpec.describe WorkPackages::BaseContract,done_ratio: :inclusionend- context "when unset while % complete is set and work is set to a negative value" do+ context "when empty while % complete is set and work is set to a negative value" dolet(:estimated_hours) { -3 }let(:remaining_hours) { nil }let(:done_ratio) { 50 }@@ -490,7 +490,7 @@ RSpec.describe WorkPackages::BaseContract,it_behaves_like "contract is valid"end- context "when unset while work and remaining work are set" do+ context "when empty while work and remaining work are set" dolet(:estimated_hours) { 4 }let(:remaining_hours) { 3 }let(:done_ratio) { nil }@@ -498,7 +498,7 @@ RSpec.describe WorkPackages::BaseContract,it_behaves_like "contract is invalid", done_ratio: :must_be_set_when_work_and_remaining_work_are_setend- context "when unset while work is set and remaining work is set to a negative value" do+ context "when empty while work is set and remaining work is set to a negative value" dolet(:estimated_hours) { 4 }let(:remaining_hours) { -3 }let(:done_ratio) { nil }@@ -518,7 +518,7 @@ RSpec.describe WorkPackages::BaseContract,done_ratio: nilend- context "when unset while remaining work is set and work is set to a negative value" do+ context "when empty while remaining work is set and work is set to a negative value" dolet(:estimated_hours) { -4 }let(:remaining_hours) { 3 }let(:done_ratio) { nil }@@ -578,7 +578,7 @@ RSpec.describe WorkPackages::BaseContract,endend- context "when remaining work exceeds work and done_ratio is unset" do+ context "when remaining work exceeds work and done_ratio is empty" dolet(:estimated_hours) { 5.0 }let(:remaining_hours) { 6.0 }let(:done_ratio) { nil }@@ -590,7 +590,7 @@ RSpec.describe WorkPackages::BaseContract,done_ratio: nilend- context "when all three unset" do+ context "when all three empty" dolet(:estimated_hours) { nil }let(:remaining_hours) { nil }let(:done_ratio) { nil }@@ -630,7 +630,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is invalid", done_ratio: :cannot_be_set_when_work_is_zeroend- context "when % complete is unset" do+ context "when % complete is empty" dolet(:done_ratio) { nil }include_examples "contract is valid"@@ -653,7 +653,7 @@ RSpec.describe WorkPackages::BaseContract,context "and work is set" dolet(:estimated_hours) { 10 }- context "and remaining work is unset" do+ context "and remaining work is empty" dolet(:remaining_hours) { nil }include_examples "contract is invalid",@@ -678,10 +678,10 @@ RSpec.describe WorkPackages::BaseContract,endend- context "and work is unset" do+ context "and work is empty" dolet(:estimated_hours) { nil }- context "and remaining work is unset" do+ context "and remaining work is empty" dolet(:remaining_hours) { nil }include_examples "contract is valid"@@ -691,7 +691,7 @@ RSpec.describe WorkPackages::BaseContract,let(:remaining_hours) { 0 }include_examples "contract is invalid", estimated_hours: nil,- remaining_hours: :must_be_unset_when_work_is_unset_and_percent_complete_is_100p,+ remaining_hours: :must_be_empty_when_work_is_empty_and_percent_complete_is_100p,done_ratio: nilend@@ -699,13 +699,13 @@ RSpec.describe WorkPackages::BaseContract,let(:remaining_hours) { 5 }include_examples "contract is invalid", estimated_hours: nil,- remaining_hours: :must_be_unset_when_work_is_unset_and_percent_complete_is_100p,+ remaining_hours: :must_be_empty_when_work_is_empty_and_percent_complete_is_100p,done_ratio: nilendendend- context "when work and remaining work are both unset" do+ context "when work and remaining work are both empty" dolet(:estimated_hours) { nil }let(:remaining_hours) { nil }@@ -715,7 +715,7 @@ RSpec.describe WorkPackages::BaseContract,include_examples "contract is valid"end- context "when % complete is unset" do+ context "when % complete is empty" dolet(:done_ratio) { nil }include_examples "contract is valid"diff --git a/spec/features/work_packages/display_fields/work_display_spec.rb b/spec/features/work_packages/display_fields/work_display_spec.rbindex 50b46f3f047..1d345835f2c 100644--- a/spec/features/work_packages/display_fields/work_display_spec.rb+++ b/spec/features/work_packages/display_fields/work_display_spec.rb@@ -116,7 +116,7 @@ RSpec.describe "Work display", :js doinclude_examples "work display", expected_text: "0h·Σ 3h"end- context "with just total work (parent work unset)" do+ context "with just total work (parent work empty)" dolet_work_packages(<<~TABLE)hierarchy | work |parent | |diff --git a/spec/features/work_packages/progress_modal_spec.rb b/spec/features/work_packages/progress_modal_spec.rbindex 5da8fbd865d..658c7b13103 100644--- a/spec/features/work_packages/progress_modal_spec.rb+++ b/spec/features/work_packages/progress_modal_spec.rb@@ -369,7 +369,7 @@ RSpec.describe "Progress modal", :js, :with_cuprite,endend- context "with unset values" do+ context "with empty values" dobefore doupdate_work_package_with(work_package, estimated_hours: nil, remaining_hours: nil, done_ratio: nil)end@@ -430,7 +430,7 @@ RSpec.describe "Progress modal", :js, :with_cuprite,context "given work = 10h, remaining work = 4h, % complete = 60%" dobefore { update_work_package_with(work_package, estimated_hours: 10.0, remaining_hours: 4.0) }- specify "Case 1: When I unset work it unsets remaining work" do+ specify "Case 1: When I clear work it clears remaining work" dovisit_progress_query_displaying_work_packageprogress_popover.opendiff --git a/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb b/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rbindex 6d695996233..50ba599878b 100644--- a/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb+++ b/spec/services/work_packages/set_attributes_service/derive_progress_values_status_based_spec.rb@@ -83,11 +83,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBaswork_package.clear_changes_informationend- context "when work is unset" do+ context "when work is cleared" dolet(:set_attributes) { { estimated_hours: nil } }let(:expected_derived_attributes) { { remaining_hours: nil } }- include_examples "update progress values", description: "unsets remaining work"+ include_examples "update progress values", description: "clearss remaining work"endcontext "when work is changed" do@@ -121,7 +121,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBasendend- context "given a work package with work and remaining work unset, and a status with 0% complete" do+ context "given a work package with work and remaining work being empty, and a status with 0% complete" dobefore dowork_package.status = status_0_pct_completework_package.done_ratio = work_package.status.default_done_ratio@@ -135,7 +135,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBaslet(:expected_derived_attributes) { { remaining_hours: nil } }include_examples "update progress values",- description: "remaining work remains unset"+ description: "remaining work remains empty"endcontext "when work is set" do@@ -143,7 +143,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesStatusBaslet(:expected_derived_attributes) { { remaining_hours: 10.0 } }include_examples "update progress values",- description: "remaining work is updated accordingly from work and % complete value of the status"+ description: "remaining work is derived from work and % complete value of the status"endcontext "when work is set to a negative value" dodiff --git a/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb b/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rbindex f1e5de46d8e..0b16320a274 100644--- a/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb+++ b/spec/services/work_packages/set_attributes_service/derive_progress_values_work_based_spec.rb@@ -79,31 +79,31 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedwork_package.clear_changes_informationend- context "when work is unset" do+ context "when work is cleared" dolet(:set_attributes) { { estimated_hours: nil } }let(:expected_derived_attributes) { { remaining_hours: nil } }let(:expected_kept_attributes) { %w[done_ratio] }- include_examples "update progress values", description: "keeps % complete, and unsets remaining work"+ include_examples "update progress values", description: "keeps % complete, and clears remaining work"end- context "when remaining work is unset" do+ context "when remaining work is cleared" dolet(:set_attributes) { { remaining_hours: nil } }let(:expected_derived_attributes) { { estimated_hours: nil } }let(:expected_kept_attributes) { %w[done_ratio] }- include_examples "update progress values", description: "keeps % complete, and unsets work"+ include_examples "update progress values", description: "keeps % complete, and clears work"end- context "when % complete is unset" do+ context "when % complete is cleared" dolet(:set_attributes) { { done_ratio: nil } }let(:expected_derived_attributes) { { remaining_hours: nil } }let(:expected_kept_attributes) { %w[estimated_hours] }- include_examples "update progress values", description: "keeps work, and unsets remaining work"+ include_examples "update progress values", description: "keeps work, and clears remaining work"end- context "when both work and remaining work are unset" do+ context "when both work and remaining work are cleared" dolet(:set_attributes) { { estimated_hours: nil, remaining_hours: nil } }let(:expected_kept_attributes) { %w[done_ratio] }@@ -117,14 +117,14 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedinclude_examples "update progress values", description: "derives remaining work from work and % complete"end- context "when both work and percent complete are unset" do+ context "when both work and percent complete are cleared" dolet(:set_attributes) { { estimated_hours: nil, done_ratio: nil } }let(:expected_kept_attributes) { %w[remaining_hours] }include_examples "update progress values", description: "keeps remaining work"end- context "when both remaining work and percent complete are unset" do+ context "when both remaining work and percent complete are cleared" dolet(:set_attributes) { { remaining_hours: nil, done_ratio: nil } }let(:expected_kept_attributes) { %w[estimated_hours] }@@ -139,7 +139,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendinclude_examples "update progress values",- description: "remaining work is increased by the same amount, and % complete is updated accordingly"+ description: "remaining work is increased by the same amount, and % complete is derived"endcontext "when work is set to 0h" do@@ -149,7 +149,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendinclude_examples "update progress values",- description: "remaining work is set to 0h and % Complete is unset"+ description: "remaining work is set to 0h and % Complete is cleared"endcontext "when work is decreased" do@@ -160,7 +160,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendinclude_examples "update progress values",- description: "remaining work is decreased by the same amount, and % complete is updated accordingly"+ description: "remaining work is decreased by the same amount, and % complete is derived"endcontext "when work is decreased below remaining work value" do@@ -195,7 +195,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:set_attributes) { { remaining_hours: 12.0, done_ratio: 40 } }let(:expected_derived_attributes) { { estimated_hours: 20.0 } }- include_examples "update progress values", description: "work is updated accordingly"+ include_examples "update progress values", description: "work is derived"endcontext "when remaining work is changed and % complete is changed to 100%" do@@ -253,32 +253,32 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedinclude_examples "update progress values", description: "updates % complete accordingly"end- context "when work is changed and remaining work is unset" do+ context "when work is changed and remaining work is cleared" dolet(:set_attributes) { { estimated_hours: 8.0, remaining_hours: nil } }let(:expected_derived_attributes) { { done_ratio: nil } }- include_examples "update progress values", description: "% complete is unset"+ include_examples "update progress values", description: "% complete is cleared"end- context "when percent complete is changed and work is unset" do+ context "when percent complete is changed and work is cleared" dolet(:set_attributes) { { done_ratio: 40, estimated_hours: nil } }let(:expected_derived_attributes) { { remaining_hours: nil } }- include_examples "update progress values", description: "remaining work is unset"+ include_examples "update progress values", description: "remaining work is cleared"end- context "when percent complete is changed and remaining work is unset" do+ context "when percent complete is changed and remaining work is cleared" dolet(:set_attributes) { { done_ratio: 40, remaining_hours: nil } }let(:expected_derived_attributes) { { estimated_hours: nil } }- include_examples "update progress values", description: "work is unset"+ include_examples "update progress values", description: "work is cleared"endcontext "when % complete is changed and remaining work is set to same value" dolet(:set_attributes) { { done_ratio: 90, remaining_hours: 3 } }let(:expected_derived_attributes) { { estimated_hours: 30 } }- include_examples "update progress values", description: "work is updated accordingly"+ include_examples "update progress values", description: "work is derived"endcontext "when work is set to the same value and remaining work is changed" do@@ -286,7 +286,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { done_ratio: 90 } }include_examples "update progress values",- description: "% complete is updated accordingly"+ description: "% complete is derived"endcontext "when work is increased and remaining work is set to its current value (to prevent it from being increased)" do@@ -295,7 +295,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { remaining_hours: 3.0, done_ratio: 85 } }include_examples "update progress values",- description: "remaining work is kept (not increased), and % complete is updated accordingly"+ description: "remaining work is kept (not increased), and % complete is derived"endcontext "when % complete is changed" do@@ -303,7 +303,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { remaining_hours: 6.0 } }let(:expected_kept_attributes) { %w[estimated_hours] }- include_examples "update progress values", description: "work is kept, and remaining work is updated accordingly"+ include_examples "update progress values", description: "work is kept, and remaining work is derived"endcontext "when % complete is changed to a negative value" do@@ -355,7 +355,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendend- context "given a work package with work and % complete being set, and remaining work being unset" do+ context "given a work package with work and % complete being set, and remaining work being empty" dobefore dowork_package.estimated_hours = 10work_package.remaining_hours = nil@@ -368,7 +368,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { remaining_hours: 14.0 } }let(:expected_kept_attributes) { %w[done_ratio] }- include_examples "update progress values", description: "% complete is kept and remaining work is updated accordingly"+ include_examples "update progress values", description: "% complete is kept and remaining work is derived"endcontext "when work is changed to a negative value" do@@ -385,7 +385,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { done_ratio: 90.0 } }let(:expected_kept_attributes) { %w[estimated_hours] }- include_examples "update progress values", description: "work is kept and % complete is updated accordingly"+ include_examples "update progress values", description: "work is kept and % complete is derived"endcontext "when % complete is set" do@@ -393,11 +393,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { remaining_hours: 1.0 } }let(:expected_kept_attributes) { %w[estimated_hours] }- include_examples "update progress values", description: "work is kept and remaining work is updated accordingly"+ include_examples "update progress values", description: "work is kept and remaining work is derived"endend- context "given a work package with remaining work and % complete being set, and work being unset" do+ context "given a work package with remaining work and % complete being set, and work being empty" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = 2.0@@ -410,7 +410,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { estimated_hours: 20.0 } }let(:expected_kept_attributes) { %w[done_ratio] }- include_examples "update progress values", description: "% complete is kept and work is updated accordingly"+ include_examples "update progress values", description: "% complete is kept and work is derived"endcontext "when % complete is 0% and remaining work is changed to a decimal rounded up" do@@ -424,7 +424,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendinclude_examples "update progress values",- description: "% complete is kept, values are rounded, and work is updated accordingly"+ description: "% complete is kept, values are rounded, and work is derived"endcontext "when work is set" do@@ -432,7 +432,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { done_ratio: 80.0 } }let(:expected_kept_attributes) { %w[remaining_hours] }- include_examples "update progress values", description: "remaining work is kept and % complete is updated accordingly"+ include_examples "update progress values", description: "remaining work is kept and % complete is derived"endcontext "when % complete is changed" do@@ -440,7 +440,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { estimated_hours: 10.0 } }let(:expected_kept_attributes) { %w[remaining_hours] }- include_examples "update progress values", description: "remaining work is kept and work is updated accordingly"+ include_examples "update progress values", description: "remaining work is kept and work is derived"endcontext "when % complete is changed to 100%" do@@ -453,7 +453,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendend- context "given a work package with work being set, and remaining work and % complete being unset" do+ context "given a work package with work being set, and remaining work and % complete being empty" dobefore dowork_package.estimated_hours = 10work_package.remaining_hours = nil@@ -469,12 +469,12 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBaseddescription: "remaining work is set to the same value and % complete is set to 0%"end- context "when work is changed and remaining work is unset" do+ context "when work is changed and remaining work is cleared" dolet(:set_attributes) { { estimated_hours: 10.0, remaining_hours: nil } }let(:expected_kept_attributes) { %w[done_ratio] }include_examples "update progress values",- description: "% complete is kept and remaining work is kept unset and not recomputed " \+ description: "% complete is kept and remaining work is kept empty and not recomputed " \"(error state to be detected by contract)"end@@ -493,11 +493,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_kept_attributes) { %w[estimated_hours] }include_examples "update progress values",- description: "work is kept and remaining work is updated accordingly"+ description: "work is kept and remaining work is derived"endend- context "given a work package with remaining work being set, and work and % complete being unset" do+ context "given a work package with remaining work being set, and work and % complete being cleared" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = 6.0@@ -511,7 +511,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_kept_attributes) { %w[remaining_hours] }include_examples "update progress values",- description: "remaining work is kept to the same value and % complete is updated accordingly"+ description: "remaining work is kept to the same value and % complete is derived"endcontext "when work is set lower than remaining work" do@@ -554,11 +554,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { estimated_hours: 10.0 } }let(:expected_kept_attributes) { %w[remaining_hours] }- include_examples "update progress values", description: "work is updated accordingly"+ include_examples "update progress values", description: "work is derived"endend- context "given a work package with work and remaining work set to 0h, and % complete being unset" do+ context "given a work package with work and remaining work set to 0h, and % complete being empty" dobefore dowork_package.estimated_hours = 0work_package.remaining_hours = 0@@ -575,7 +575,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendend- context "given a work package with work and remaining work unset, and % complete being set" do+ context "given a work package with work and remaining work being empty, and % complete being set" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = nil@@ -588,7 +588,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_derived_attributes) { { remaining_hours: 4.0 } }let(:expected_kept_attributes) { %w[done_ratio] }- include_examples "update progress values", description: "% complete is kept and remaining work is updated accordingly"+ include_examples "update progress values", description: "% complete is kept and remaining work is derived"endcontext "when work is set to a number with with 4 decimals" do@@ -598,7 +598,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedinclude_examples "update progress values",description: "% complete is kept, work is rounded to 2 decimals, " \- "and remaining work is updated and rounded to 2 decimals"+ "and remaining work is derived and rounded to 2 decimals"endcontext "when work is set to a string" do@@ -618,14 +618,14 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:set_attributes) { { estimated_hours: 10.0, remaining_hours: 0 } }let(:expected_derived_attributes) { { done_ratio: 100 } }- include_examples "update progress values", description: "% complete is updated accordingly"+ include_examples "update progress values", description: "% complete is derived"end- context "when work is set and remaining work is unset" do+ context "when work is set and remaining work is clered" dolet(:set_attributes) { { estimated_hours: 10.0, remaining_hours: nil } }let(:expected_derived_attributes) { { done_ratio: nil } }- include_examples "update progress values", description: "% complete is unset"+ include_examples "update progress values", description: "% complete is cleared"endcontext "when work and remaining work are both set to negative values" do@@ -641,11 +641,11 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_kept_attributes) { %w[estimated_hours remaining_hours] }include_examples "update progress values",- description: "work and remaining work are kept unset"+ description: "work and remaining work are kept empty"endend- context "given a work package with work and remaining work unset, and % complete being set to 100%" do+ context "given a work package with work and remaining work being empty, and % complete being set to 100%" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = nil@@ -678,7 +678,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:set_attributes) { { estimated_hours: 10.0, remaining_hours: 5.0 } }let(:expected_derived_attributes) { { done_ratio: 50 } }- include_examples "update progress values", description: "% complete is updated accordingly"+ include_examples "update progress values", description: "% complete is derived"endcontext "when remaining work is set to 0h" do@@ -690,7 +690,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedendend- context "given a work package with work, remaining work, and % complete being unset" do+ context "given a work package with work, remaining work, and % complete being empty" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = nil@@ -733,12 +733,12 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBased"and % complete and work are kept"end- context "when remaining work is set and work is unset" do+ context "when remaining work is set and work is cleared" dolet(:set_attributes) { { estimated_hours: nil, remaining_hours: 6.7 } }let(:expected_kept_attributes) { %w[done_ratio] }include_examples "update progress values",- description: "% complete is kept and work is kept unset and not recomputed" \+ description: "% complete is kept and work is kept empty and not recomputed" \"(error state to be detected by contract)"end@@ -747,7 +747,7 @@ RSpec.describe WorkPackages::SetAttributesService::DeriveProgressValuesWorkBasedlet(:expected_kept_attributes) { %w[estimated_hours remaining_hours] }include_examples "update progress values",- description: "work and remaining work are kept unset"+ description: "work and remaining work are kept empty"endendenddiff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rbindex b7ffa0a2883..de94a3aaf2c 100644--- a/spec/services/work_packages/set_attributes_service_spec.rb+++ b/spec/services/work_packages/set_attributes_service_spec.rb@@ -172,7 +172,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context "given a work package with work and remaining work unset, and a status with 0% complete" do+ context "given a work package with work and remaining work being empty, and a status with 0% complete" dobefore dowork_package.status = status_0_pct_completework_package.done_ratio = work_package.status.default_done_ratio@@ -186,7 +186,7 @@ RSpec.describe WorkPackages::SetAttributesService,let(:expected_attributes) { { remaining_hours: nil } }it_behaves_like "service call",- description: "remaining work remains unset"+ description: "remaining work remains empty"endcontext "when work is set" do@@ -194,7 +194,7 @@ RSpec.describe WorkPackages::SetAttributesService,let(:expected_attributes) { { remaining_hours: 10.0 } }it_behaves_like "service call",- description: "remaining work is updated accordingly from work and % complete value of the status"+ description: "remaining work is derived from work and % complete value of the status"endendend@@ -209,11 +209,11 @@ RSpec.describe WorkPackages::SetAttributesService,work_package.clear_changes_informationend- context "when remaining work is unset" do+ context "when remaining work is cleared" dolet(:call_attributes) { { remaining_hours: nil } }let(:expected_attributes) { { estimated_hours: nil, done_ratio: 70 } }- it_behaves_like "service call", description: "keeps % complete, and unsets work"+ it_behaves_like "service call", description: "keeps % complete, and clears work"endcontext "when work is increased" do@@ -224,7 +224,7 @@ RSpec.describe WorkPackages::SetAttributesService,endit_behaves_like "service call",- description: "remaining work is increased by the same amount, and % complete is updated accordingly"+ description: "remaining work is increased by the same amount, and % complete is derived"endcontext "when work and remaining work are both changed to values with more than 2 decimals" do@@ -250,7 +250,7 @@ RSpec.describe WorkPackages::SetAttributesService,endend- context "given a work package with work and remaining work unset, and % complete being set" do+ context "given a work package with work and remaining work being empty, and % complete being set" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = nil@@ -263,11 +263,11 @@ RSpec.describe WorkPackages::SetAttributesService,let(:expected_attributes) { { remaining_hours: 4.0 } }let(:expected_kept_attributes) { %w[done_ratio] }- it_behaves_like "service call", description: "% complete is kept and remaining work is updated accordingly"+ it_behaves_like "service call", description: "% complete is kept and remaining work is derived"endend- context "given a work package with work, remaining work, and % complete being unset" do+ context "given a work package with work, remaining work, and % complete being empty" dobefore dowork_package.estimated_hours = nilwork_package.remaining_hours = nil