2014-01-02 00:21:49 +01:00
|
|
|
class RegionsController < InheritedResources::Base
|
2014-01-05 18:48:32 +01:00
|
|
|
def stats
|
2014-07-01 15:50:39 +02:00
|
|
|
@region_events = Event.joins(:related_region).group(:name).count(:name)
|
2014-01-05 18:48:32 +01:00
|
|
|
|
2014-05-10 12:06:34 +02:00
|
|
|
@city_events = Event.group(:city).having('count(city) > 3').order('count(city) desc').count(:city)
|
2014-01-05 18:48:32 +01:00
|
|
|
|
2014-05-10 12:06:34 +02:00
|
|
|
@month_events = Event
|
2014-01-05 18:48:32 +01:00
|
|
|
.group('extract(year from start_time)')
|
|
|
|
.group('extract(month from start_time)')
|
|
|
|
.count()
|
|
|
|
end
|
2014-01-02 00:21:49 +01:00
|
|
|
end
|