mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-18 14:11:10 +00:00
Statistics on top of Events#index
This commit is contained in:
parent
f5e52e3855
commit
f5701f2e77
3 changed files with 24 additions and 0 deletions
|
|
@ -316,6 +316,20 @@ class Conference < ActiveRecord::Base
|
|||
Conference.calculate_event_distribution_hash(program.events.select(:state).group(:state).count)
|
||||
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}
|
||||
# active: signed in during the last 3 months
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue