FIX: make report data export more resilient to inconsistent date format

The DAU/MAU report export was failing because of date being a string
and not a valid Date value
This commit is contained in:
Arpit Jalan 2018-05-24 17:14:08 +05:30
parent 54a9073d94
commit cafd1241b9

View File

@ -183,11 +183,11 @@ module Jobs
report_hash = {}
Report.find(@extra[:name], @extra).data.each do |row|
report_hash[row[:x].to_s(:db)] = row[:y].to_s(:db)
report_hash[row[:x].to_s] = row[:y].to_s
end
(@extra[:start_date].to_date..@extra[:end_date].to_date).each do |date|
yield [date.to_s(:db), report_hash.fetch(date.to_s(:db), 0)]
yield [date.to_s(:db), report_hash.fetch(date.to_s, 0)]
end
end