From a177fccb6e0719da0c88d216da61da9c36839284 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Tue, 19 Sep 2023 14:03:41 +0300 Subject: [PATCH] fixed auction type sorting --- app/models/auction/searchable.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/auction/searchable.rb b/app/models/auction/searchable.rb index aebd19c58..b3b0a278f 100644 --- a/app/models/auction/searchable.rb +++ b/app/models/auction/searchable.rb @@ -2,6 +2,9 @@ module Auction::Searchable extend ActiveSupport::Concern + BLIND = '0'.freeze + ENGLISH = '1'.freeze + included do scope :active, -> { where('starts_at <= ? AND ends_at >= ?', Time.now.utc, Time.now.utc) } scope :without_result, lambda { @@ -88,7 +91,8 @@ def search(params = {}, current_user = nil) .with_offers(params[:auction_offer_type], params[:type]) if params[:sort] == 'users_price' - query.with_max_offer_cents_for_english_auction(current_user).order("offers_subquery.max_offer_cents #{sort_direction} NULLS LAST") + query.with_max_offer_cents_for_english_auction(current_user) + .order("offers_subquery.max_offer_cents #{sort_direction} NULLS LAST") elsif params[:sort] == 'username' query.sorted_by_winning_offer_username.order("offers_subquery.username #{sort_direction} NULLS LAST") else