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
[55656] Remove derivedRemainingTime from form payload
Christophe Bliard5ee2ba5cca17
diff --git a/lib/api/utilities/payload_representer.rb b/lib/api/utilities/payload_representer.rbindex 50aa1bbbeb7..60aa6857e9b 100644--- a/lib/api/utilities/payload_representer.rb+++ b/lib/api/utilities/payload_representer.rb@@ -51,12 +51,15 @@ module API# Note: `:writeable` is not a typo, it's used by declarative gemwritable = property[:writeable]++ # If writable is a lambda, rely on it to determine if the property should be output+ # else if writable is explicitly false, do not output the property+ # else rely on #writable_attributes (through UnwritablePropertyFilter) to know if the property should be output+ next if writable.respond_to?(:call)+if writable == falseproperty.merge!(readable: false)- end-- # Only filter unwritable if not a lambda- unless writable.respond_to?(:call)+ elseadd_filter(property, UnwritablePropertyFilter)endenddiff --git a/lib/api/v3/work_packages/work_package_representer.rb b/lib/api/v3/work_packages/work_package_representer.rbindex b282a43722c..8794762cec3 100644--- a/lib/api/v3/work_packages/work_package_representer.rb+++ b/lib/api/v3/work_packages/work_package_representer.rb@@ -418,7 +418,6 @@ module APIdatetime_formatter.format_duration_from_hours(represented.derived_remaining_hours,allow_nil: true)end,- writable: ->(*) { !WorkPackage.use_status_for_done_ratio? },render_nil: trueproperty :duration,diff --git a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rbindex 25f288df2ae..e5095d5eaf9 100644--- a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb+++ b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb@@ -133,6 +133,14 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter doendend+ describe "derived remaining hours" do+ context "when set" do+ let(:work_package) { build(:work_package, derived_remaining_hours: 5) }++ it { is_expected.not_to have_json_path("derivedRemainingTime") }+ end+ end+describe "startDate" dobefore doallow(work_package)