diff --git a/app/controllers/admin/auctions_controller.rb b/app/controllers/admin/auctions_controller.rb index 6b6cc4d9c..80793e086 100644 --- a/app/controllers/admin/auctions_controller.rb +++ b/app/controllers/admin/auctions_controller.rb @@ -5,7 +5,8 @@ module Admin def index params[:q] ||= {} - @auctions = Auction.with_status(params[:statuses_contains]) + @auctions = Auction.with_domain_name(params[:domain_matches]) + .with_status(params[:statuses_contains]) .with_start_created_at_date(params[:created_at_start]) .with_end_created_at_date(params[:created_at_end]) @@ -16,7 +17,7 @@ module Admin @auctions = @q.result.page(params[:page]) end - @auctions = @auctions.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? + @auctions = @auctions.per(params[:results_per_page_auction]) if params[:results_per_page_auction].to_i.positive? domains = ReservedDomain.all.order(:name) q = domains.ransack(PartialSearchFormatter.format(params[:q])) @@ -57,14 +58,6 @@ module Admin end end - def send_to_auction - auction = Auction.find(params[:id]) - - p ">>>>>.." - p auction - p ">>>>>>" - end - private def validate_table(table) diff --git a/app/models/auction.rb b/app/models/auction.rb index cb0e9916d..d7d1e1c23 100644 --- a/app/models/auction.rb +++ b/app/models/auction.rb @@ -29,6 +29,10 @@ class Auction < ApplicationRecord where("created_at <= ?", end_created_at) if end_created_at.present? } + scope :with_domain_name, -> (domain_name) { + where('domain ilike ?', "%#{domain_name.strip}%") if domain_name.present? + } + def self.pending(domain_name) find_by(domain: domain_name.to_s, status: PENDING_STATUSES) end diff --git a/app/views/admin/auctions/index.html.erb b/app/views/admin/auctions/index.html.erb index e4407ded3..9d530b80f 100644 --- a/app/views/admin/auctions/index.html.erb +++ b/app/views/admin/auctions/index.html.erb @@ -117,9 +117,6 @@