From 5c5c5ac96a425b9f0234fbb92cf5179c6dc30bbd Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Thu, 19 Oct 2017 16:12:10 +0300 Subject: [PATCH] Use correct scopes for confirmation filter --- app/models/event_search.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/event_search.rb b/app/models/event_search.rb index 7912e4d..6c0632d 100644 --- a/app/models/event_search.rb +++ b/app/models/event_search.rb @@ -6,8 +6,8 @@ class EventSearch option(:track_id) { |scope, value| scope.where track_id: value } option(:event_type_id) { |scope, value| scope.where event_type_id: value } option(:status) { |scope, value| scope.joins(:proposition).where(propositions: {status: value}) } - option(:confirmed) { |scope, value| scope.joins(:proposition).where(status: :approved).where.not(confirmed_at: nil) } - option(:not_confirmed) { |scope, value| scope.joins(:proposition).where(status: :approved, confirmed_at: nil) } + option(:confirmed) { |scope, value| scope.joins(:proposition).approved.where.not(propositions: {confirmed_at: nil}) } + option(:not_confirmed) { |scope, value| scope.joins(:proposition).approved.where(propositions: {confirmed_at: nil}) } sort_by 'title' config[:defaults]['sort'] = "#{config[:sort_attributes].first} asc"