18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/active_tracker/plugin/exception.rb', line 18
def self.statistics
ret = []
@exceptions = ActiveTracker::Model.all("Exception")
num_exceptions = @exceptions.count
exceptions_last_day = @exceptions.select {|e| e.log_at >= 1.day.ago}.count
exceptions_last_30_minutes = @exceptions.select {|e| e.log_at >= 30.minutes.ago}.count
ret << {plugin: self, label: "Last 24 hours", value: exceptions_last_day}
if exceptions_last_30_minutes == 0
ret << {plugin: self, label: "Last 30 min", value: exceptions_last_30_minutes}
else
ret << {plugin: self, label: "Last 30 min", value: exceptions_last_30_minutes, error: true}
end
ret
end
|