Project

General

Profile

Defect #31637 » 0001-Fix-csv-format-of-hours.patch

Seiei Miyagi, 2020-07-23 09:22

View differences:

app/helpers/queries_helper.rb
case column.name
when :attachments
value.to_a.map {|a| a.filename}.join("\n")
when :hours, :estimated_hours, :total_estimated_hours, :spent_hours, :total_spent_hours
format_hours(value)
else
format_object(value, false) do |value|
case value.class.name
test/helpers/queries_helper_test.rb
assert_include "Non", csv
end
end
def test_csv_value
c_hours = QueryColumn.new(:hours)
c_estimated_hours = QueryColumn.new(:estimated_hours)
c_hourtotal_estimated_s = QueryColumn.new(:total_estimated_hours)
c_spent_hours = QueryColumn.new(:spent_hours)
c_total_spent_hours = QueryColumn.new(:total_spent_hours)
with_settings timespan_format: 'minutes' do
assert_equal "0:30", csv_value(c_hours, Issue.find(1), 0.5)
assert_equal "0:30", csv_value(c_estimated_hours, Issue.find(1), 0.5)
assert_equal "0:30", csv_value(c_hourtotal_estimated_s, Issue.find(1), 0.5)
assert_equal "0:30", csv_value(c_spent_hours, Issue.find(1), 0.5)
assert_equal "0:30", csv_value(c_total_spent_hours, Issue.find(1), 0.5)
end
with_settings timespan_format: 'decimal' do
assert_equal "0.50", csv_value(c_hours, Issue.find(1), 0.5)
assert_equal "0.50", csv_value(c_estimated_hours, Issue.find(1), 0.5)
assert_equal "0.50", csv_value(c_hourtotal_estimated_s, Issue.find(1), 0.5)
assert_equal "0.50", csv_value(c_spent_hours, Issue.find(1), 0.5)
assert_equal "0.50", csv_value(c_total_spent_hours, Issue.find(1), 0.5)
end
end
end
(1-1/2)