From cf03cac40ef65e20b398805a04c4553f95c59089 Mon Sep 17 00:00:00 2001 From: Marcello Rocha Date: Wed, 9 Aug 2023 18:22:48 +0200 Subject: [PATCH] Updates other affected specs --- .../backlogs/patches/api/work_package_representer.rb | 12 +++++++----- .../work_packages/update_ancestors/loader_patch.rb | 4 ++-- .../work_packages/update_ancestors/loader_spec.rb | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/backlogs/lib/open_project/backlogs/patches/api/work_package_representer.rb b/modules/backlogs/lib/open_project/backlogs/patches/api/work_package_representer.rb index d84b6df632ec..799b98fc41b7 100644 --- a/modules/backlogs/lib/open_project/backlogs/patches/api/work_package_representer.rb +++ b/modules/backlogs/lib/open_project/backlogs/patches/api/work_package_representer.rb @@ -37,13 +37,15 @@ def extension ->(*) do property :position, render_nil: true, - skip_render: ->(*) { !(backlogs_enabled? && type && type.passes_attribute_constraint?(:position)) } + skip_render: ->(*) do + !(backlogs_enabled? && type && type.passes_attribute_constraint?(:position)) + end property :story_points, render_nil: true, - skip_render: ->(*) { - !(backlogs_enabled? && type && type.passes_attribute_constraint?(:story_points)) - } + skip_render: ->(*) do + !(backlogs_enabled? && type && type.passes_attribute_constraint?(:story_points)) + end property :remaining_time, exec_context: :decorator, @@ -64,7 +66,7 @@ def extension # cannot use def here as it wouldn't define the method on the representer define_method :remaining_time= do |value| represented.remaining_hours = datetime_formatter - .parse_duration_to_hours(value, 'remainingTime', allow_nil: true) + .parse_duration_to_hours(value, 'remainingTime', allow_nil: true) end define_method :derived_remaining_time= do |value| diff --git a/modules/backlogs/lib/open_project/backlogs/patches/work_packages/update_ancestors/loader_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/work_packages/update_ancestors/loader_patch.rb index 8a0f5b9e6288..989c27d9c9c3 100644 --- a/modules/backlogs/lib/open_project/backlogs/patches/work_packages/update_ancestors/loader_patch.rb +++ b/modules/backlogs/lib/open_project/backlogs/patches/work_packages/update_ancestors/loader_patch.rb @@ -33,11 +33,11 @@ module InstanceMethods private def selected_descendants_attributes - super + %i(remaining_hours derived_remaining_hours) + super + %i(remaining_hours) end def selected_leaves_attributes - super + [:remaining_hours] + super + %i[remaining_hours derived_remaining_hours] end end end diff --git a/spec/services/work_packages/update_ancestors/loader_spec.rb b/spec/services/work_packages/update_ancestors/loader_spec.rb index b44931568a63..be6daaa28fa2 100644 --- a/spec/services/work_packages/update_ancestors/loader_spec.rb +++ b/spec/services/work_packages/update_ancestors/loader_spec.rb @@ -209,6 +209,7 @@ def descendants_of_hash(hashed_work_package) "id" => hashed_work_package.id, "ignore_non_working_days" => false, "parent_id" => hashed_work_package.parent_id, + "remaining_hours" => nil, "schedule_manually" => false } end @@ -257,6 +258,7 @@ def children_of_hash(hashed_work_package) "id" => hashed_work_package.id, "ignore_non_working_days" => false, "parent_id" => hashed_work_package.parent_id, + "remaining_hours" => nil, "schedule_manually" => false } end