Bid.get_delta_amount refactor

master
E. Almqvist 3 years ago
parent 2850f07c9f
commit 816f9ce80f
  1. 11
      src/lib/db_models.rb

@ -462,10 +462,13 @@ class Bid < EntityModel
def self.get_delta_amount(ahid, uid, amount)
data = self.get "*", "auction_id = ?, user_id = ?", ahid, uid
data && data.map! {|dat| self.new(dat)}
p data
return amount
if data then
data.map! {|dat| self.new(dat)}
max_bid = data.max_by {|bid| bid.amount}
return amount - max_bid
else
return amount
end
end
def self.validate_bid(ahid, uid, amount, message)

Loading…
Cancel
Save