summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-09 12:44:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-09 12:44:08 +0000
commitb0a47cc5ba2e75af883dd3a0d116e6466e31148b (patch)
tree0dde23c6d80ce47d9a23b36956293957c16644b9 /app/models/issue_query.rb
parent9c7832d82230d96e8599df3574dc9d27811c23d8 (diff)
downloadredmine-b0a47cc5ba2e75af883dd3a0d116e6466e31148b.tar.gz
redmine-b0a47cc5ba2e75af883dd3a0d116e6466e31148b.zip
Fixes float conversion failures (#1561).
git-svn-id: http://svn.redmine.org/redmine/trunk@14668 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index 4528f4a9b..37f7ee391 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -320,12 +320,12 @@ class IssueQuery < Query
# Returns sum of all the issue's estimated_hours
def total_for_estimated_hours(scope)
- scope.sum(:estimated_hours)
+ map_total(scope.sum(:estimated_hours)) {|t| t.to_f.round(2)}
end
# Returns sum of all the issue's time entries hours
def total_for_spent_hours(scope)
- if group_by_column.try(:name) == :project
+ total = if group_by_column.try(:name) == :project
# TODO: remove this when https://github.com/rails/rails/issues/21922 is fixed
# We have to do a custom join without the time_entries.project_id column
# that would trigger a ambiguous column name error
@@ -334,6 +334,7 @@ class IssueQuery < Query
else
scope.joins(:time_entries).sum("#{TimeEntry.table_name}.hours")
end
+ map_total(total) {|t| t.to_f.round(2)}
end
# Returns the issues