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)
report.data = []
(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
report.data << {x: i.days.ago.to_date.to_s, y: count}
count = PostAction.where('date(created_at) = ?', i.days.ago.utc.to_date)
.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
flagsQuery = PostAction.where(post_action_type_id: PostActionType.flag_types.values)

View File

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