renamed column in auction from type to platform

This commit is contained in:
olegphenomenon 2022-04-13 10:54:49 +03:00
parent d8c0ba2432
commit 9766650ae4
9 changed files with 16 additions and 15 deletions

View file

@ -24,24 +24,25 @@ module Admin
end
def create
auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started], platform: :english)
auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started], platform: 'english')
if auction.save
remove_from_reserved(auction)
flash[:notice] = "Auction #{params[:domain]} created"
else
flash[:alert] = "Something goes wrong"
flash[:alert] = 'Something goes wrong'
end
redirect_to admin_auctions_path
end
def upload_spreadsheet
table = CSV.parse(File.read(params[:q][:file]), headers: true)
filename = params[:q][:file]
table = CSV.parse(File.read(filename), headers: true)
table.each do |row|
record = row.to_h
auction = Auction.new(domain: record['name'], status: Auction.statuses[:started], platform: :english)
auction = Auction.new(domain: record['name'], status: Auction.statuses[:started], platform: 'english')
remove_from_reserved(auction) if auction.save!
end