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
Format journal entries chronically for work/remaining work
Aaron Contreras438887d23c3c
diff --git a/app/models/work_package/journalized.rb b/app/models/work_package/journalized.rbindex 2a8bac58a9a..310e70c561c 100644--- a/app/models/work_package/journalized.rb+++ b/app/models/work_package/journalized.rb@@ -78,7 +78,7 @@ module WorkPackage::Journalizedurl: JournalizedProcs.event_urlregister_journal_formatted_fields(:id, "parent_id")- register_journal_formatted_fields(:fraction,+ register_journal_formatted_fields(:chronic_duration,"estimated_hours", "derived_estimated_hours","remaining_hours", "derived_remaining_hours")register_journal_formatted_fields(:percentage, "done_ratio", "derived_done_ratio")diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb b/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rbindex e551577fc5e..4eef2b950f1 100644--- a/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb+++ b/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb@@ -52,6 +52,7 @@require_relative "journal_formatter_cache"require_relative "journal_formatter/base"require_relative "journal_formatter/attribute"+require_relative "journal_formatter/chronic_duration"require_relative "journal_formatter/datetime"require_relative "journal_formatter/day_count"require_relative "journal_formatter/decimal"@@ -76,6 +77,7 @@ module JournalFormatterdef self.default_formatters{+ chronic_duration: JournalFormatter::ChronicDuration,datetime: JournalFormatter::Datetime,day_count: JournalFormatter::DayCount,decimal: JournalFormatter::Decimal,diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_formatter/chronic_duration.rb b/lib_static/plugins/acts_as_journalized/lib/journal_formatter/chronic_duration.rbnew file mode 100644index 00000000000..e83b035f6aa--- /dev/null+++ b/lib_static/plugins/acts_as_journalized/lib/journal_formatter/chronic_duration.rb@@ -0,0 +1,41 @@+# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2010-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++module JournalFormatter+ class ChronicDuration < Attribute+ def format_values(values)+ values.map do |v|+ if v.nil?+ nil+ else+ ::DurationConverter.output(v.to_f)+ end+ end+ end+ end+end