aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-12-04 09:10:03 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-12-04 09:10:03 +0000
commitff17da300f361425f0e22ccd9066cb6577aa10ee (patch)
treeec220c3bfdd7cd105d4ba2695fe1608cd44ec331 /lib
parent66d2bcbfb05499ed4a185b0dff0829c8c49f4d08 (diff)
Fixed event views to use dates, and to miss queries for days with no events.
Diffstat (limited to 'lib')
-rw-r--r--lib/mauve/web_interface.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mauve/web_interface.rb b/lib/mauve/web_interface.rb
index c6de5ff..5bb339a 100644
--- a/lib/mauve/web_interface.rb
+++ b/lib/mauve/web_interface.rb
@@ -528,13 +528,13 @@ EOF
query[:history][:created_at.gte] = Time.local(today.year, today.month, today.day, 0, 0, 0)
query[:history][:created_at.lt] = Time.local(tomorrow.year, tomorrow.month, tomorrow.day, 0, 0, 0)
- events = AlertHistory.all(formulate_events_query(query)).history
+ events = AlertHistory.all(formulate_events_query(query))
event_week = ((today - start)/7).floor
event_day = (today.wday == 0 ? 6 : (today.wday - 1))
@events_by_week[event_week] ||= Array.new(7) { Array.new }
- @events_by_week[event_week][event_day] = events
+ @events_by_week[event_week][event_day] = (events.count == 0 ? [] : events.history)
today = tomorrow
end