1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

Fix: Spent time CSV report returning hours as Rational instead of Float (#41895).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23351 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2024-12-04 01:58:51 +00:00
parent 2f5d543234
commit 81291bb25e
2 changed files with 11 additions and 1 deletions

View File

@ -309,7 +309,7 @@ module QueriesHelper
else
format_object(value, html: false) do |value|
case value.class.name
when 'Float'
when 'Float', 'Rational'
sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator))
when 'IssueRelation'
value.to_s(object)

View File

@ -1740,6 +1740,16 @@ class TimelogControllerTest < Redmine::ControllerTest
get :index, :params => {:format => 'csv'}
assert_response :success
assert_equal 'text/csv; header=present', response.media_type
parsed_csv = CSV.parse(response.body)
assert_equal %w[Project Date User Activity Issue Comment Hours], parsed_csv.first
assert_equal(
[
'eCookbook', '03/12/2007', 'Redmine Admin', 'Design',
'Bug #1: Cannot print recipes', '', '150.00'
],
parsed_csv.last
)
end
end