diff --git a/lib/api/v3/work_packages/schema/work_package_schema.rb b/lib/api/v3/work_packages/schema/work_package_schema.rb index 874a3a48cf..5ab8e0de41 100644 --- a/lib/api/v3/work_packages/schema/work_package_schema.rb +++ b/lib/api/v3/work_packages/schema/work_package_schema.rb @@ -80,18 +80,18 @@ module API def percentage_done_writable? if Setting.work_package_done_ratio == 'status' || - Setting.work_package_done_ratio == 'disabled' + Setting.work_package_done_ratio == 'disabled' return false end - work_package_present_and_parent? + is_leaf_or_nil?(@work_package) end def estimated_time_writable? - work_package_present_and_parent? + is_leaf_or_nil?(@work_package) end - def work_package_present_and_parent? - @work_package.nil? ? true : @work_package.children.count < 1 + def is_leaf_or_nil?(work_package) + work_package.nil? ? true : work_package.children.empty? end end end