utc vs non utc is a subtle issue, tests were failing for a few hours every day cause of this

This commit is contained in:
Sam 2013-04-04 13:29:54 +11:00
parent 86cf7b1524
commit e61a28f3e1
2 changed files with 6 additions and 3 deletions

View file

@ -75,8 +75,11 @@ class Report
def self.report_flags(report) def self.report_flags(report)
report.data = [] report.data = []
(0..30).to_a.reverse.each do |i| (0..30).to_a.reverse.each do |i|
if (count = PostAction.where('date(created_at) = ?', i.days.ago.to_date).where(post_action_type_id: PostActionType.flag_types.values).count) > 0 count = PostAction.where('date(created_at) = ?', i.days.ago.utc.to_date)
report.data << {x: i.days.ago.to_date.to_s, y: count} .where(post_action_type_id: PostActionType.flag_types.values)
.count
if count > 0
report.data << {x: i.days.ago.utc.to_date.to_s, y: count}
end end
end end
flagsQuery = PostAction.where(post_action_type_id: PostActionType.flag_types.values) flagsQuery = PostAction.where(post_action_type_id: PostActionType.flag_types.values)

View file

@ -140,4 +140,4 @@ describe Report do
end end
end end
end end