Project

General

Profile

Defect #32500 » fix-32500.patch

Yuichi HARADA, 2019-12-05 08:01

View differences:

app/helpers/timelog_helper.rb
79 79
  def report_to_csv(report)
80 80
    Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
81 81
      # Column headers
82
      headers = report.criteria.collect {|criteria| l(report.available_criteria[criteria][:label]) }
82
      headers = report.criteria.collect {|criteria| l_or_humanize(report.available_criteria[criteria][:label]) }
83 83
      headers += report.periods
84 84
      headers << l(:label_total_time)
85 85
      csv << headers
test/functional/timelog_report_test.rb
247 247
      :columns => 'month',
248 248
      :from => "2007-01-01",
249 249
      :to => "2007-06-30",
250
      :criteria => ["project", "user", "activity"],
250
      :criteria => ["project", "user", "cf_10"],
251 251
      :format => "csv"
252 252
    }
253 253
    assert_response :success
254 254
    assert_equal 'text/csv', @response.content_type
255 255
    lines = @response.body.chomp.split("\n")
256 256
    # Headers
257
    assert_equal 'Project,User,Activity,2007-3,2007-4,Total time', lines.first
257
    assert_equal 'Project,User,Overtime,2007-3,2007-4,Total time', lines.first
258 258
    # Total row
259 259
    assert_equal 'Total time,"","",154.25,8.65,162.90', lines.last
260 260
  end
(2-2/2)