* jamtrack session stats VRFS-3835
This commit is contained in:
parent
922cfc4540
commit
854d7caab9
|
|
@ -0,0 +1,37 @@
|
|||
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_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;")
|
||||
|
||||
content :title => "Month Stats" do
|
||||
h2 "Distinct Users Playing in Sessions"
|
||||
table_for distinct_users do
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Users", :count
|
||||
end
|
||||
|
||||
h2 "Music Sessions"
|
||||
table_for total_session do
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
h2 "Music Sessions with JamTracks Played"
|
||||
table_for total_jamtrack_sessions do
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
h2 "JamTrack Web Player Sessions"
|
||||
table_for total_jamtrack_sessions do
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
Loading…
Reference in New Issue