Fix the submissions chart

This commit is contained in:
Petko Bordjukov 2015-04-20 19:11:39 +03:00
parent 8d5056e274
commit cf489324c2
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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}"