Remove support for old "Nebula (fake)" April Fools color

This hasn't worked for a while anyway! Let's remove the bits of code
where we deal with it, and the database field that signals it. (We also
make a corresponding change in Impress 2020, so it doesn't crash trying
to query based on the `prank` column.)

I also ran this snippet to clear out all the Nebula stuff in the db:

```rb
Color.transaction do
	nebula = Color.where(prank: true).find_by_name("Nebula")
	nebula.pet_types.includes(pet_states: :swf_assets).each do |pet_type|
		pet_type.pet_states.each do |pet_state|
			pet_state.parent_swf_asset_relationships.each do |psa|
				psa.swf_asset.destroy!
				psa.destroy!
			end
			pet_state.destroy!
		end
		pet_type.destroy!
	end
	nebula.destroy!
end
```
This commit is contained in:
Emi Matchu 2024-09-27 19:38:53 -07:00
parent d056a5e766
commit d66f81c96b
7 changed files with 15 additions and 27 deletions

View file

@ -47,7 +47,7 @@ class OutfitsController < ApplicationController
end end
def new def new
@colors = Color.funny.alphabetical @colors = Color.alphabetical
@species = Species.alphabetical @species = Species.alphabetical
# HACK: Skip this in development, because it's slow! # HACK: Skip this in development, because it's slow!

View file

@ -5,7 +5,6 @@ class Color < ApplicationRecord
scope :basic, -> { where(basic: true) } scope :basic, -> { where(basic: true) }
scope :standard, -> { where(standard: true) } scope :standard, -> { where(standard: true) }
scope :nonstandard, -> { where(standard: false) } scope :nonstandard, -> { where(standard: false) }
scope :funny, -> { order(:prank) unless pranks_funny? }
validates :name, presence: true validates :name, presence: true
@ -14,10 +13,10 @@ class Color < ApplicationRecord
end end
def human_name def human_name
if prank? && !Color.pranks_funny? if name
unfunny_human_name + ' ' + I18n.translate('colors.prank_suffix') name.split(' ').map { |word| word.capitalize }.join(' ')
else else
unfunny_human_name I18n.translate('colors.default_human_name')
end end
end end
@ -27,14 +26,6 @@ class Color < ApplicationRecord
"species_id ASC").first "species_id ASC").first
end end
def unfunny_human_name
if name
name.split(' ').map { |word| word.capitalize }.join(' ')
else
I18n.translate('colors.default_human_name')
end
end
def default_gender_presentation def default_gender_presentation
if name.downcase.ends_with? "boy" if name.downcase.ends_with? "boy"
:masc :masc
@ -44,9 +35,4 @@ class Color < ApplicationRecord
nil nil
end end
end end
def self.pranks_funny?
now = Time.now.in_time_zone('Pacific Time (US & Canada)')
now.month == 4 && now.day == 1
end
end end

View file

@ -34,7 +34,7 @@
%span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️ %span.error-icon{title: "We haven't seen this item on this pet before."} ⚠️
= select_tag "preview[color_id]", = select_tag "preview[color_id]",
options_from_collection_for_select(Color.funny.alphabetical, options_from_collection_for_select(Color.alphabetical,
"id", "human_name", @selected_preview_pet_type.color_id) "id", "human_name", @selected_preview_pet_type.color_id)
= select_tag "preview[species_id]", = select_tag "preview[species_id]",
options_from_collection_for_select(Species.alphabetical, options_from_collection_for_select(Species.alphabetical,

View file

@ -36,7 +36,8 @@ en:
blog: Blog blog: Blog
contact: Contact contact: Contact
email: Questions, comments, bugs email: Questions, comments, bugs
copyright: Images © 1999%{year} World of Neopets, Inc. All Rights Reserved. copyright:
Images © 1999%{year} World of Neopets, Inc. All Rights Reserved.
Used With Permission Used With Permission
items: items:
@ -167,8 +168,7 @@ en:
submit: Save submit: Save
edit: Edit edit: Edit
delete: Delete delete: Delete
delete_confirmation: delete_confirmation: Are you sure you want to delete "%{list_name}"?
Are you sure you want to delete "%{list_name}"?
If you do, we'll delete all the items in it, too. If you do, we'll delete all the items in it, too.
remove_all: remove_all:
confirm: "Remove all items from this list?" confirm: "Remove all items from this list?"
@ -215,7 +215,6 @@ en:
colors: colors:
default_human_name: (a new color) default_human_name: (a new color)
prank_suffix: (fake)
contributions: contributions:
contributed_description: contributed_description:

View file

@ -0,0 +1,5 @@
class RemovePrankFromColors < ActiveRecord::Migration[7.2]
def change
remove_column "colors", "prank", :boolean, default: false, null: false
end
end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_04_08_120359) do ActiveRecord::Schema[7.2].define(version: 2024_04_08_120359) do
create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t| create_table "users", id: { type: :integer, unsigned: true }, charset: "utf8mb3", collation: "utf8mb3_general_ci", force: :cascade do |t|
t.string "name", limit: 30, null: false t.string "name", limit: 30, null: false
t.string "encrypted_password", limit: 64 t.string "encrypted_password", limit: 64
@ -37,5 +37,4 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_08_120359) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true
end end
end end

View file

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2024_06_16_001002) do ActiveRecord::Schema[7.2].define(version: 2024_09_28_022359) do
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t| create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.integer "species_id", null: false t.integer "species_id", null: false
t.integer "color_id", null: false t.integer "color_id", null: false
@ -75,7 +75,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_06_16_001002) do
create_table "colors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t| create_table "colors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_520_ci", force: :cascade do |t|
t.boolean "basic" t.boolean "basic"
t.boolean "standard" t.boolean "standard"
t.boolean "prank", default: false, null: false
t.string "name", null: false t.string "name", null: false
t.string "pb_item_name" t.string "pb_item_name"
t.string "pb_item_thumbnail_url" t.string "pb_item_thumbnail_url"