Statistics on top of Events#index
This commit is contained in:
parent
f5e52e3855
commit
f5701f2e77
3 changed files with 24 additions and 0 deletions
|
|
@ -21,6 +21,9 @@ module Admin
|
||||||
@difficulty_levels = @program.difficulty_levels
|
@difficulty_levels = @program.difficulty_levels
|
||||||
@machine_states = @events.state_machine.states.map
|
@machine_states = @events.state_machine.states.map
|
||||||
@event_types = @program.event_types
|
@event_types = @program.event_types
|
||||||
|
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
|
||||||
|
@event_distribution = @conference.event_distribution
|
||||||
|
@scheduled_event_distribution = @conference.scheduled_event_distribution
|
||||||
|
|
||||||
@mystates = []
|
@mystates = []
|
||||||
@mytypes = []
|
@mytypes = []
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,20 @@ class Conference < ActiveRecord::Base
|
||||||
Conference.calculate_event_distribution_hash(program.events.select(:state).group(:state).count)
|
Conference.calculate_event_distribution_hash(program.events.select(:state).group(:state).count)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns a hash with scheduled vs unscheduled events
|
||||||
|
# { "Scheduled" => { value: number of confirmed and scheduled events, color: color },
|
||||||
|
# "Unscheduled" => { value: number of confirmed and unscheduled events, color: color }
|
||||||
|
#
|
||||||
|
# ====Returns
|
||||||
|
# * +hash+ -> hash
|
||||||
|
def scheduled_event_distribution
|
||||||
|
confirmed_events = program.events.where(state: 'confirmed')
|
||||||
|
scheduled_value = { 'value' => confirmed_events.where('start_time IS NOT NULL').count, 'color' => 'green' }
|
||||||
|
unscheduled_value = { 'value' => confirmed_events.where('start_time IS NULL').count, 'color' => 'red' }
|
||||||
|
{ 'Scheduled' => scheduled_value, 'Unscheduled' => unscheduled_value }
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns a hash with user distribution => {value: count of user state, color: color}
|
# Returns a hash with user distribution => {value: count of user state, color: color}
|
||||||
# active: signed in during the last 3 months
|
# active: signed in during the last 3 months
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@
|
||||||
%p.text-muted
|
%p.text-muted
|
||||||
All the submissions of your speakers
|
All the submissions of your speakers
|
||||||
.row
|
.row
|
||||||
|
.col-md-4
|
||||||
|
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Events state', data: @event_distribution}
|
||||||
|
.col-md-4
|
||||||
|
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution}
|
||||||
|
.col-md-4
|
||||||
|
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed}
|
||||||
|
.row{ style: "margin-top: 40px;"}
|
||||||
.col-md-12
|
.col-md-12
|
||||||
%table.table.table-striped.table-bordered.table-hover.datatable
|
%table.table.table-striped.table-bordered.table-hover.datatable
|
||||||
%thead
|
%thead
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue