mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 15:34:41 +02:00
Merge pull request #2403 from internetee/exceptions-for-registered-domains-and-no-bids-auctions
added exception for auctions with no-bids and registred-domains statuses
This commit is contained in:
commit
4a31cc3b15
3 changed files with 65 additions and 9 deletions
|
@ -37,6 +37,24 @@ class Auction < ApplicationRecord
|
|||
find_by(domain: domain_name.to_s, status: PENDING_STATUSES)
|
||||
end
|
||||
|
||||
def self.domain_exists_in_blocked_disputed_and_registered?(domain_name)
|
||||
Domain.exists?(name: domain_name) ||
|
||||
BlockedDomain.exists?(name: domain_name) ||
|
||||
Dispute.exists?(domain_name: domain_name) ||
|
||||
exception_for_registred_or_unbided_existed_auctions(domain_name)
|
||||
end
|
||||
|
||||
def self.exception_for_registred_or_unbided_existed_auctions(domain_name)
|
||||
return false unless Auction.exists?(domain: domain_name)
|
||||
|
||||
auctions = Auction.where(domain: domain_name).order(:created_at)
|
||||
last_record = auctions.last
|
||||
|
||||
return false if last_record.domain_registered? || last_record.no_bids?
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def start
|
||||
self.status = self.class.statuses[:started]
|
||||
save!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue