Skip to content

Commit

Permalink
renamed column in auction from type to platform
Browse files Browse the repository at this point in the history
  • Loading branch information
olegphenomenon committed Apr 13, 2022
1 parent a5423e5 commit 2c8d8b6
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/auctions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def index
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
Expand All @@ -41,7 +41,7 @@ def upload_spreadsheet

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

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/reserved_domains_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def release_to_auction
reserved_domains = ReservedDomain.where(id: reserved_domains_ids)

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!
end

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/auction_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module AuctionHelper
include ActionView::Helpers::TagHelper

extend self

def colorize_auction(auction)
Expand All @@ -16,6 +16,6 @@ def render_status_black(name)
end

def render_status_green(name)
content_tag(:span, name.to_s , style: 'color: green;')
content_tag(:span, name.to_s, style: 'color: green;')
end
end
4 changes: 2 additions & 2 deletions app/models/auction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ class Auction < ApplicationRecord
domain_not_registered: 'domain_not_registered',
}

enum type: %i[blind english]
enum platform: %i[blind english]

PENDING_STATUSES = [statuses[:started],
statuses[:awaiting_payment],
statuses[:payment_received]].freeze

private_constant :PENDING_STATUSES

scope :with_status, -> (status) {
scope :with_status, ->(status) {
where(status: status) if status.present?
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/dns/domain_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def unavailability_reason
def sell_at_auction
auction = Auction.new
auction.domain = name
auction.platform = :blind
auction.platform = 'blind'
auction.start
ToStdout.msg "Created the auction: #{auction.inspect}"
update_whois_from_auction(auction)
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ en:
log_out: 'Log out (%{user})'
system: 'System'
domains: 'Domains'
auctions: 'Auctions'
registrars: 'Registrars'
valid_to: 'Valid to'
name: 'Name'
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20220412130856_add_type_to_auction.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddTypeToAuction < ActiveRecord::Migration[6.1]
def change
# add_column :auctions, :type, :integer, null: true
add_column :auctions, :platform, :integer, null: true
end
end
3 changes: 2 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ CREATE TABLE public.auctions (
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
created_at timestamp without time zone NOT NULL,
registration_code character varying,
registration_deadline timestamp without time zone
registration_deadline timestamp without time zone,
platform integer
);


Expand Down

0 comments on commit 2c8d8b6

Please sign in to comment.