]> source.dussan.org Git - redmine.git/commitdiff
Merged r16491 (#25526).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 5 Apr 2017 16:12:04 +0000 (16:12 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 5 Apr 2017 16:12:04 +0000 (16:12 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16494 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb

index 2d9ff3eaba64d2771fc089c657ca10a63e1ff4af..a1505b4c349bd6a81a29c4ac53957fcb83e232f7 100644 (file)
@@ -964,7 +964,7 @@ class Issue < ActiveRecord::Base
 
   # Returns the number of hours spent on this issue
   def spent_hours
-    @spent_hours ||= time_entries.sum(:hours) || 0
+    @spent_hours ||= time_entries.sum(:hours) || 0.0
   end
 
   # Returns the total number of hours spent on this issue and its descendants
@@ -1003,7 +1003,7 @@ class Issue < ActiveRecord::Base
     if issues.any?
       hours_by_issue_id = TimeEntry.visible(user).where(:issue_id => issues.map(&:id)).group(:issue_id).sum(:hours)
       issues.each do |issue|
-        issue.instance_variable_set "@spent_hours", (hours_by_issue_id[issue.id] || 0)
+        issue.instance_variable_set "@spent_hours", (hours_by_issue_id[issue.id] || 0.0)
       end
     end
   end
@@ -1016,7 +1016,7 @@ class Issue < ActiveRecord::Base
           " AND parent.lft <= #{Issue.table_name}.lft AND parent.rgt >= #{Issue.table_name}.rgt").
         where("parent.id IN (?)", issues.map(&:id)).group("parent.id").sum(:hours)
       issues.each do |issue|
-        issue.instance_variable_set "@total_spent_hours", (hours_by_issue_id[issue.id] || 0)
+        issue.instance_variable_set "@total_spent_hours", (hours_by_issue_id[issue.id] || 0.0)
       end
     end
   end