Skip to content

Commit

Permalink
fixed auction type sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Sep 19, 2023
1 parent 7c9de3d commit a177fcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/auction/searchable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a177fcc

Please sign in to comment.