From 2d325c492c6d88c26aea1ba8e59e27bfc040f9c9 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 10 Aug 2015 21:18:12 +0300 Subject: [PATCH] Fix an SQL query that fails on postgres --- app/models/conference.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index 62dd795..5d773e6 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -24,12 +24,12 @@ class Conference < ActiveRecord::Base end def submissions_grouped_by_day - submissions = events.group('date(events.created_at)').select('events.created_at, count(events.id) as number') + submissions = events.group('date(events.created_at)').select('date(events.created_at) as 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 = events.approved.confirmed.group('date(events.confirmed_at)').select('date(events.confirmed_at) as confirmed_at, count(events.id) as number') submissions.group_by { |s| s.confirmed_at.to_date } end