Make calculate_event_distribution use state to group events

Signed-off-by: Carlos Coelho <carlos@vinta.com.br>
This commit is contained in:
Carlos Coelho 2018-02-18 16:16:40 -03:00 committed by Stella Rouzi
parent 9c322d682f
commit 5f7029d28e

View file

@ -1029,7 +1029,7 @@ class Conference < ApplicationRecord
# * +hash+ -> object_type => {color, value}
def calculate_event_distribution(group_by_id, association_symbol, state = nil)
grouped = if state
program.events.select(group_by_id).where('state = ?', 'confirmed').group(group_by_id)
program.events.select(group_by_id).where('state = ?', state).group(group_by_id)
else
program.events.select(group_by_id).group(group_by_id)
end