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