Oops, fix new bug in homepage modeling code
Missed a spot on `Item#basic_body_ids`!
This commit is contained in:
parent
e52838ba70
commit
b6bddb14be
2 changed files with 7 additions and 4 deletions
|
@ -294,7 +294,7 @@ class Item < ApplicationRecord
|
||||||
# all bodies of the same color. (To my knowledge, anyway. I'm not aware
|
# all bodies of the same color. (To my knowledge, anyway. I'm not aware
|
||||||
# of any exceptions.) So, let's find those bodies by first finding those
|
# of any exceptions.) So, let's find those bodies by first finding those
|
||||||
# colors.
|
# colors.
|
||||||
basic_body_ids = PetType.basic.distinct.pluck(:body_id)
|
basic_body_ids = PetType.basic_body_ids
|
||||||
basic_compatible_body_ids, nonbasic_compatible_body_ids =
|
basic_compatible_body_ids, nonbasic_compatible_body_ids =
|
||||||
compatible_body_ids.partition { |bi| basic_body_ids.include?(bi) }
|
compatible_body_ids.partition { |bi| basic_body_ids.include?(bi) }
|
||||||
|
|
||||||
|
@ -335,9 +335,8 @@ class Item < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def predicted_missing_nonstandard_body_pet_types
|
def predicted_missing_nonstandard_body_pet_types
|
||||||
PetType.joins(:color).
|
body_ids = predicted_missing_body_ids - PetType.basic_body_ids
|
||||||
where(body_id: predicted_missing_body_ids - basic_body_ids,
|
PetType.joins(:color).where(body_id: body_ids, colors: {standard: false})
|
||||||
colors: {standard: false})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def predicted_missing_nonstandard_body_ids_by_species_by_color
|
def predicted_missing_nonstandard_body_ids_by_species_by_color
|
||||||
|
|
|
@ -116,6 +116,10 @@ class PetType < ApplicationRecord
|
||||||
"#{color.human_name}-#{species.human_name}"
|
"#{color.human_name}-#{species.human_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.basic_body_ids
|
||||||
|
PetType.basic.distinct.pluck(:body_id)
|
||||||
|
end
|
||||||
|
|
||||||
def self.all_by_ids_or_children(ids, pet_states)
|
def self.all_by_ids_or_children(ids, pet_states)
|
||||||
pet_states_by_pet_type_id = {}
|
pet_states_by_pet_type_id = {}
|
||||||
pet_states.each do |pet_state|
|
pet_states.each do |pet_state|
|
||||||
|
|
Loading…
Reference in a new issue