Compare commits

..

No commits in common. "23c083ff1d0056b3c56e42795823db468039c615" and "bb83f6fd36feec1e9e409892d7af093f3b5270f4" have entirely different histories.

6 changed files with 36 additions and 24 deletions

View file

@ -63,7 +63,7 @@ class AltStylesController < ApplicationController
protected
def alt_style_params
params.require(:alt_style).permit(:real_series_name, :thumbnail_url)
params.require(:alt_style).permit(:series_name, :thumbnail_url)
end
def find_color

View file

@ -1,5 +1,5 @@
module OutfitsHelper
LAST_DAY_OF_ANNOUNCEMENT = Date.parse("2024-10-21")
LAST_DAY_OF_ANNOUNCEMENT = Date.parse("2024-10-10")
def show_announcement?
Date.today <= LAST_DAY_OF_ANNOUNCEMENT
end

View file

@ -4,7 +4,7 @@ class AltStyle < ApplicationRecord
belongs_to :species
belongs_to :color
has_many :parent_swf_asset_relationships, as: :parent, dependent: :destroy
has_many :parent_swf_asset_relationships, as: :parent
has_many :swf_assets, through: :parent_swf_asset_relationships
has_many :contributions, as: :contributed, inverse_of: :contributed
@ -12,7 +12,8 @@ class AltStyle < ApplicationRecord
validates :series_name, presence: true, allow_nil: true
validates :thumbnail_url, presence: true
before_validation :infer_thumbnail_url, unless: :thumbnail_url?
before_create :infer_series_name
before_create :infer_thumbnail_url
scope :matching_name, ->(series_name, color_name, species_name) {
color = Color.find_by_name!(color_name)
@ -35,21 +36,13 @@ class AltStyle < ApplicationRecord
# `fits:<New?>-faerie-draik` intentionally will not work, and the canonical
# filter name will be `fits:alt-style-IDNUMBER`, instead.
def series_name
real_series_name || "<New?>"
end
def real_series_name=(new_series_name)
self[:series_name] = new_series_name
end
def real_series_name
self[:series_name]
self[:series_name] || "<New?>"
end
# You can use this to check whether `series_name` is returning the actual
# value or its placeholder value.
def real_series_name?
real_series_name.present?
def has_real_series_name?
self[:series_name].present?
end
def adjective_name
@ -81,6 +74,19 @@ class AltStyle < ApplicationRecord
end
end
# Until the end of 2024, assume new alt styles are from the "Nostalgic"
# series. That way, we can stop having to manually label them all as they
# come out and get modeled (TNT is prolific rn!), but we aren't gonna get too
# greedy and forget about this and use Nostalgic for some far-future thing,
# in ways that will certainly be fixable but would also be confusing and
# embarrassing.
NOSTALGIC_FINAL_DAY = Date.new(2024, 12, 31)
def infer_series_name
if !has_real_series_name? && Date.today <= NOSTALGIC_FINAL_DAY
self.series_name = "Nostalgic"
end
end
# At time of writing, most batches of Alt Styles thumbnails used a simple
# pattern for the item thumbnail URL, but that's not always the case anymore.
# For now, let's keep using this format as the default value when creating a

View file

@ -367,7 +367,7 @@ class Item
# If the real series name has been set in the database by support
# staff, use that for the canonical filter text for this alt style.
# Otherwise, represent this alt style by ID.
if alt_style.real_series_name?
if alt_style.has_real_series_name?
series_name = alt_style.series_name.downcase
color_name = alt_style.color.name.downcase
species_name = alt_style.species.name.downcase

View file

@ -21,8 +21,8 @@
- @alt_style.errors.each do |error|
%li= error.full_message
%fieldset
= f.label :real_series_name, "Series"
= f.text_field :real_series_name
= f.label :series_name, "Series"
= f.text_field :series_name
= f.label :thumbnail_url, "Thumbnail"
.thumbnail-field
- if @alt_style.thumbnail_url?

View file

@ -11,13 +11,19 @@
.content
%p
%strong
🎃
= link_to "New pet styles are out today!", alt_styles_path
If you've seen one we don't have yet, please model it by entering the
pet's name in the box below. Thank you!!
= link_to "This week in DTI: Performance upgrades!",
"https://blog.openneo.net/2024/10/03/perf-upgrades.html"
If you saw the site stutter, whoops, you weren't imagining it! We've
dug into our past and made three changes to speed up the site for
everyone, whew!
%p
By the way, we had a bug where modeling new styles wasn't working for a
little while. Fixed now! 🤞
Also, in case you can help:
= succeed "," do
= link_to "I'm job-hunting right now",
"https://blog.openneo.net/2024/10/03/perf-upgrades.html#job-hunting"
looking for
full-time software roles!
%em (You gotta ask, right?)
#outfit-forms
#pet-preview