Skip to content

Commit

Permalink
Merge pull request #1133 from internetee/fixed-auction-type-sorting
Browse files Browse the repository at this point in the history
fixed auction type sorting
  • Loading branch information
vohmar authored Sep 20, 2023
2 parents 334fcc5 + a177fcc commit 0ba9aa8
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 0ba9aa8

Please sign in to comment.