Default to masc/fem for colors like "elderlyboy", in item previews

instead of doing the random choice we do for most colors.

This is especially noticeable in cases where like, I'm looking at the
Elderlyboy Ogrin and like, it has *work* put into the masc eyes, and
them fem eyes are just the standard ones.
This commit is contained in:
Emi Matchu 2024-09-07 16:12:05 -07:00
parent 620e59f3ed
commit d470dde135
2 changed files with 15 additions and 3 deletions

View file

@ -35,6 +35,16 @@ class Color < ApplicationRecord
end end
end end
def default_gender_presentation
if name.downcase.ends_with? "boy"
:masc
elsif name.downcase.ends_with? "girl"
:fem
else
nil
end
end
def self.pranks_funny? def self.pranks_funny?
now = Time.now.in_time_zone('Pacific Time (US & Canada)') now = Time.now.in_time_zone('Pacific Time (US & Canada)')
now.month == 4 && now.day == 1 now.month == 4 && now.day == 1

View file

@ -107,9 +107,11 @@ class PetType < ApplicationRecord
def canonical_pet_state def canonical_pet_state
# For consistency (randomness is always scary!), we use the PetType ID to # For consistency (randomness is always scary!), we use the PetType ID to
# determine which gender to prefer. That way, it'll be stable, but we'll # determine which gender to prefer, if it's not built into the color. That
# still get the *vibes* of uniform randomness. # way, it'll be stable, but we'll still get the *vibes* of randomness.
preferred_gender = id % 2 == 0 ? :fem : :masc preferred_gender = color.default_gender_presentation ||
(id % 2 == 0 ? :fem : :masc)
puts preferred_gender
# NOTE: If this were only being called on one pet type at a time, it would # NOTE: If this were only being called on one pet type at a time, it would
# be more efficient to send this as a single query with an `order` part and # be more efficient to send this as a single query with an `order` part and