Skip to content

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

convert passed remaining hours string value to the right hour format

Behrokh Satarnejad14903b8b4295
diff --git a/app/models/work_package.rb b/app/models/work_package.rb
index d873070c3e9..e7a2ed46fc1 100644
--- a/app/models/work_package.rb
+++ b/app/models/work_package.rb
@@ -310,6 +310,11 @@ class WorkPackage < ApplicationRecord
write_attribute :estimated_hours, !!converted_hours ? converted_hours : hours
end
+ def remaining_hours=(hours)
+ converted_hours = (hours.is_a?(String) ? hours.to_hours : hours)
+ write_attribute :remaining_hours, !!converted_hours ? converted_hours : hours
+ end
+
def duration_in_hours
duration ? duration * 24 : nil
end