Skip to content

Commit

Permalink
FIX: crashes with date conversion in reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed Jun 20, 2018
1 parent a171464 commit fa43969
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def self.report_time_to_first_response(report)
report.higher_is_better = false
report.data = []
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
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)
Expand All @@ -296,7 +296,7 @@ def self.report_time_to_first_response(report)
def self.report_topics_with_no_response(report)
report.data = []
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
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)
Expand Down

1 comment on commit fa43969

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/admin-dashboard-next-json-typeerror-no-implicit-conversion-of-date-into-string/90293/6

Please sign in to comment.