From b462005a321f484a73231a7d057f800184be8d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 23 Mar 2017 09:41:16 +0100 Subject: [PATCH] Fix engine --- lib/open_project/backlogs/engine.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/open_project/backlogs/engine.rb b/lib/open_project/backlogs/engine.rb index 75ebc7f469..0074317ac0 100644 --- a/lib/open_project/backlogs/engine.rb +++ b/lib/open_project/backlogs/engine.rb @@ -140,7 +140,7 @@ module OpenProject::Backlogs extend_api_response(:v3, :work_packages, :work_package) do property :story_points, render_nil: true, - if: ->(*) { backlogs_enabled? && type && type.has_attribute?(:story_points) } + if: ->(*) { backlogs_enabled? && type && type.passes_attribute_constraint?(:story_points) } property :remaining_time, exec_context: :decorator, @@ -155,7 +155,7 @@ module OpenProject::Backlogs extend_api_response(:v3, :work_packages, :work_package_payload) do property :story_points, render_nil: true, - if: ->(*) { backlogs_enabled? && type && type.has_attribute?(:story_points) } + if: ->(*) { backlogs_enabled? && type && type.passes_attribute_constraint?(:story_points) } property :remaining_time, exec_context: :decorator, @@ -179,7 +179,7 @@ module OpenProject::Backlogs required: false, show_if: -> (*) { represented.project && represented.project.backlogs_enabled? && - (!represented.type || represented.type.has_attribute?(:story_points)) + (!represented.type || represented.type.passes_attribute_constraint?(:story_points)) } schema :remaining_time, @@ -266,8 +266,7 @@ module OpenProject::Backlogs project.nil? || project.backlogs_enabled? end - ::Type.add_default_mapping(:story_points, :estimates_and_time) - ::Type.add_default_mapping(:remaining_time, :estimates_and_time) + ::Type.add_default_mapping(:estimates_and_time, :story_points, :remaining_time) end end end