From f81daff3b22857bb10dc3345d8355bcdb4f307ad Mon Sep 17 00:00:00 2001 From: olegphenomenon Date: Thu, 21 Jul 2022 08:43:57 +0300 Subject: [PATCH] added exception for auctions with no-bids and registred-domains statuses --- app/controllers/admin/auctions_controller.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/auctions_controller.rb b/app/controllers/admin/auctions_controller.rb index c1023b705..b987bc133 100644 --- a/app/controllers/admin/auctions_controller.rb +++ b/app/controllers/admin/auctions_controller.rb @@ -111,7 +111,18 @@ module Admin Domain.exists?(name: domain_name) || BlockedDomain.exists?(name: domain_name) || Dispute.exists?(domain_name: domain_name) || - Auction.exists?(domain: domain_name) + exception_for_registred_or_unbided_existed_auctions(domain_name) + end + + def 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 validate_table(table)