diff --git a/app/models/conference.rb b/app/models/conference.rb index 4162112..6c1c44e 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -15,6 +15,16 @@ class Conference < ActiveRecord::Base accepts_nested_attributes_for :tracks, :halls, reject_if: :all_blank, allow_destroy: true + def submissions_grouped_by_day + submissions = events.group('date(events.created_at)').select('events.created_at, count(events.id) as number') + submissions.group_by { |s| s.created_at.to_date } + end + + def submissions_grouped_by_confirmation_day + submissions = events.approved.confirmed.group('date(events.confirmed_at)').select('events.confirmed_at, count(events.id) as number') + submissions.group_by { |s| s.confirmed_at.to_date } + end + private def start_date_is_before_end_date diff --git a/app/views/management/conferences/show.html.slim b/app/views/management/conferences/show.html.slim index 80f90da..7ec21be 100644 --- a/app/views/management/conferences/show.html.slim +++ b/app/views/management/conferences/show.html.slim @@ -71,6 +71,4 @@ span.clearfix .row .col-lg-12 - / Unbreak this whenever the CallForParticipation model is introduced - / .submissions-chart#submissions-chart data-submissions="#{submissions_chart_data(@conference).to_json}" - .submissions-chart#submissions-chart + .submissions-chart#submissions-chart data-submissions="#{submissions_chart_data(@conference).to_json}"