Use correct scopes for confirmation filter

This commit is contained in:
Petko Bordjukov 2017-10-19 16:12:10 +03:00
parent 0324382024
commit 5c5c5ac96a
1 changed files with 2 additions and 2 deletions

View File

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