FIX: crashes with date conversion in reports

This commit is contained in:
Joffrey JAFFEUX 2018-06-20 14:42:15 +02:00 committed by GitHub
parent a171464a55
commit fa43969fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -287,7 +287,7 @@ class Report
report.higher_is_better = false report.higher_is_better = false
report.data = [] report.data = []
Topic.time_to_first_response_per_day(report.start_date, report.end_date, category_id: report.category_id).each do |r| Topic.time_to_first_response_per_day(report.start_date, report.end_date, category_id: report.category_id).each do |r|
report.data << { x: Date.parse(r["date"]), y: r["hours"].to_f.round(2) } report.data << { x: r["date"], y: r["hours"].to_f.round(2) }
end end
report.total = Topic.time_to_first_response_total(category_id: report.category_id) report.total = Topic.time_to_first_response_total(category_id: report.category_id)
report.prev30Days = Topic.time_to_first_response_total(start_date: report.start_date - 30.days, end_date: report.start_date, category_id: report.category_id) report.prev30Days = Topic.time_to_first_response_total(start_date: report.start_date - 30.days, end_date: report.start_date, category_id: report.category_id)
@ -296,7 +296,7 @@ class Report
def self.report_topics_with_no_response(report) def self.report_topics_with_no_response(report)
report.data = [] report.data = []
Topic.with_no_response_per_day(report.start_date, report.end_date, report.category_id).each do |r| Topic.with_no_response_per_day(report.start_date, report.end_date, report.category_id).each do |r|
report.data << { x: Date.parse(r["date"]), y: r["count"].to_i } report.data << { x: r["date"], y: r["count"].to_i }
end end
report.total = Topic.with_no_response_total(category_id: report.category_id) report.total = Topic.with_no_response_total(category_id: report.category_id)
report.prev30Days = Topic.with_no_response_total(start_date: report.start_date - 30.days, end_date: report.start_date, category_id: report.category_id) report.prev30Days = Topic.with_no_response_total(start_date: report.start_date - 30.days, end_date: report.start_date, category_id: report.category_id)