* don't count unstarted sessions

This commit is contained in:
Seth Call 2016-01-28 08:08:21 -06:00
parent 3243abf837
commit a9d92b2250
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ ActiveAdmin.register_page "Monthly Stats" do
menu :parent => 'Reports'
distinct_users = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', msuh.created_at)::date as month, count(distinct(user_id)) from music_sessions_user_history msuh group by month order by month desc;")
total_session = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', ms.created_at)::date as month, count(id) from music_sessions ms group by month order by month desc;")
total_session = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', ms.created_at)::date as month, count(id) from music_sessions ms where started_at is not null group by month order by month desc;")
total_jamtrack_sessions = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(distinct(music_session_id)) from jam_track_sessions jts where session_type = 'session' group by month order by month desc;")
total_webplayer_sessions = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(id) from jam_track_sessions jts where session_type = 'browser' group by month order by month desc;")
distinct_jamtrack_users = MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(distinct(user_id)) from jam_track_sessions jts group by month order by month desc;")