summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-08-31 09:26:50 +0000
committerGo MAEDA <maeda@farend.jp>2024-08-31 09:26:50 +0000
commit8da72cb712dce17d6537cf71ab90b6d1959e37a1 (patch)
tree794967bf8d496d12ac421cf92c19710ad06f5adb /lib
parent1bf607edb9140f77fd2fc9b3eb371c7704929d23 (diff)
downloadredmine-8da72cb712dce17d6537cf71ab90b6d1959e37a1.tar.gz
redmine-8da72cb712dce17d6537cf71ab90b6d1959e37a1.zip
Fix precision issues in TimeEntry#hours calculation by returning Rational instead of Float (#40914).
Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23000 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/i18n.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb
index 0488fa289..a9cd1dd0d 100644
--- a/lib/redmine/i18n.rb
+++ b/lib/redmine/i18n.rb
@@ -50,12 +50,12 @@ module Redmine
end
def l_hours(hours)
- hours = hours.to_f
+ hours = hours.to_f unless hours.is_a?(Numeric)
l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => format_hours(hours))
end
def l_hours_short(hours)
- l(:label_f_hour_short, :value => format_hours(hours.to_f))
+ l(:label_f_hour_short, :value => format_hours(hours.is_a?(Numeric) ? hours : hours.to_f))
end
def ll(lang, str, arg=nil)