Skip to content

Commit

Permalink
fixed time extend by autobider
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegPhenomenon committed Sep 19, 2023
1 parent 7c9de3d commit 1ca7c02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/models/offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ class Offer < ApplicationRecord

attr_accessor :skip_autobider, :skip_if_wishlist_case, :skip_validation

after_create :update_auction_ends_at
after_update :update_auction_ends_at

def update_auction_ends_at
return if auction.platform == 'blind' || auction.platform.nil?

auction.update_ends_at(self)
end

def broadcast_replace_auction
return if auction.platform == 'blind' || auction.platform.nil?

Expand Down
7 changes: 5 additions & 2 deletions app/services/autobider_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def self.autobid(auction)
autobiders = bider.auctual_autobiders

filtered_autobiders = bider.filter_autobider_for_banned_users(autobiders: autobiders)
filtered_autobiders = bider.reject_autobiders_which_bid_equal_to_auction_current_price(filtered_autobiders: filtered_autobiders,
auction: auction)
filtered_autobiders = bider.reject_autobiders_which_bid_equal_to_auction_current_price(filtered_autobiders: filtered_autobiders, auction: auction)

return if filtered_autobiders.empty?

Expand Down Expand Up @@ -99,6 +98,10 @@ def outbid_if_exists(autobider:, auction:)
auction.update_minimum_bid_step(auction.min_bids_step)
end

auction.reload
offer = auction.currently_winning_offer
auction.update_ends_at(offer)

return
end

Expand Down

0 comments on commit 1ca7c02

Please sign in to comment.