diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-24 18:40:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-24 18:40:22 +0000 |
commit | 430477d4d62b88fd42cc9d4ccd959a53205b8719 (patch) | |
tree | 3e4a5dfc3a319badfd64f636bb85b72138c1be59 /app | |
parent | 492cce79759dec1d6e2fbd3931a04b20205bb5f4 (diff) | |
download | redmine-430477d4d62b88fd42cc9d4ccd959a53205b8719.tar.gz redmine-430477d4d62b88fd42cc9d4ccd959a53205b8719.zip |
Round hours when reading TimeEntry attribute.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8980 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/time_entry.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index caa1019e5..9266eb86f 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -89,6 +89,15 @@ class TimeEntry < ActiveRecord::Base write_attribute :hours, (h.is_a?(String) ? (h.to_hours || h) : h) end + def hours + h = read_attribute(:hours) + if h.is_a?(Float) + h.round(2) + else + h + end + end + # tyear, tmonth, tweek assigned where setting spent_on attributes # these attributes make time aggregations easier def spent_on=(date) |