mirror of
https://github.com/internetee/registry.git
synced 2025-07-28 13:36:15 +02:00
renamed column in auction from type to platform
This commit is contained in:
parent
d8c0ba2432
commit
9766650ae4
9 changed files with 16 additions and 15 deletions
|
@ -24,24 +24,25 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
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
|
if auction.save
|
||||||
remove_from_reserved(auction)
|
remove_from_reserved(auction)
|
||||||
flash[:notice] = "Auction #{params[:domain]} created"
|
flash[:notice] = "Auction #{params[:domain]} created"
|
||||||
else
|
else
|
||||||
flash[:alert] = "Something goes wrong"
|
flash[:alert] = 'Something goes wrong'
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to admin_auctions_path
|
redirect_to admin_auctions_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_spreadsheet
|
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|
|
table.each do |row|
|
||||||
record = row.to_h
|
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!
|
remove_from_reserved(auction) if auction.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ module Admin
|
||||||
reserved_domains = ReservedDomain.where(id: reserved_domains_ids)
|
reserved_domains = ReservedDomain.where(id: reserved_domains_ids)
|
||||||
|
|
||||||
reserved_domains.each do |domain|
|
reserved_domains.each do |domain|
|
||||||
Auction.create!(domain: domain.name, status: Auction.statuses[:started], platform: :english)
|
Auction.create!(domain: domain.name, status: Auction.statuses[:started], platform: 'english')
|
||||||
domain.destroy!
|
domain.destroy!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
module AuctionHelper
|
module AuctionHelper
|
||||||
include ActionView::Helpers::TagHelper
|
include ActionView::Helpers::TagHelper
|
||||||
|
|
||||||
extend self
|
|
||||||
|
|
||||||
def colorize_auction(auction)
|
def colorize_auction(auction)
|
||||||
case auction.status
|
case auction.status
|
||||||
|
@ -12,10 +10,10 @@ module AuctionHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_status_black(name)
|
def render_status_black(name)
|
||||||
content_tag(:span, name.to_s, style: 'color: black;')
|
tag.span name.to_s, style: 'color: black;'
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_status_green(name)
|
def render_status_green(name)
|
||||||
content_tag(:span, name.to_s , style: 'color: green;')
|
tag.span name.to_s, style: 'color: green;'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Auction < ApplicationRecord
|
||||||
domain_not_registered: 'domain_not_registered',
|
domain_not_registered: 'domain_not_registered',
|
||||||
}
|
}
|
||||||
|
|
||||||
enum type: %i[blind english]
|
enum platform: %i[blind english]
|
||||||
|
|
||||||
PENDING_STATUSES = [statuses[:started],
|
PENDING_STATUSES = [statuses[:started],
|
||||||
statuses[:awaiting_payment],
|
statuses[:awaiting_payment],
|
||||||
|
@ -17,7 +17,7 @@ class Auction < ApplicationRecord
|
||||||
|
|
||||||
private_constant :PENDING_STATUSES
|
private_constant :PENDING_STATUSES
|
||||||
|
|
||||||
scope :with_status, -> (status) {
|
scope :with_status, ->(status) {
|
||||||
where(status: status) if status.present?
|
where(status: status) if status.present?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ module DNS
|
||||||
def sell_at_auction
|
def sell_at_auction
|
||||||
auction = Auction.new
|
auction = Auction.new
|
||||||
auction.domain = name
|
auction.domain = name
|
||||||
auction.platform = :blind
|
auction.platform = 'blind'
|
||||||
auction.start
|
auction.start
|
||||||
ToStdout.msg "Created the auction: #{auction.inspect}"
|
ToStdout.msg "Created the auction: #{auction.inspect}"
|
||||||
update_whois_from_auction(auction)
|
update_whois_from_auction(auction)
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @auctions.each do |auction| %>
|
<% @auctions.each do |auction| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= AuctionHelper.colorize_auction(auction) %></td>
|
<td><%= colorize_auction(auction) %></td>
|
||||||
<td><%= auction.status %></td>
|
<td><%= auction.status %></td>
|
||||||
<td><%= auction.created_at %></td>
|
<td><%= auction.created_at %></td>
|
||||||
<td><%= auction.registration_code %></td>
|
<td><%= auction.registration_code %></td>
|
||||||
|
|
|
@ -189,6 +189,7 @@ en:
|
||||||
log_out: 'Log out (%{user})'
|
log_out: 'Log out (%{user})'
|
||||||
system: 'System'
|
system: 'System'
|
||||||
domains: 'Domains'
|
domains: 'Domains'
|
||||||
|
auctions: 'Auctions'
|
||||||
registrars: 'Registrars'
|
registrars: 'Registrars'
|
||||||
valid_to: 'Valid to'
|
valid_to: 'Valid to'
|
||||||
name: 'Name'
|
name: 'Name'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class AddTypeToAuction < ActiveRecord::Migration[6.1]
|
class AddTypeToAuction < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def change
|
||||||
# add_column :auctions, :type, :integer, null: true
|
add_column :auctions, :platform, :integer, null: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -337,7 +337,8 @@ CREATE TABLE public.auctions (
|
||||||
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||||
created_at timestamp without time zone NOT NULL,
|
created_at timestamp without time zone NOT NULL,
|
||||||
registration_code character varying,
|
registration_code character varying,
|
||||||
registration_deadline timestamp without time zone
|
registration_deadline timestamp without time zone,
|
||||||
|
platform integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue