WIP commit for speeding up item show pages

This commit is contained in:
Emi Matchu 2013-12-03 14:47:33 -06:00
parent 0cdbe99c88
commit cc7ac363dd
3 changed files with 8 additions and 2 deletions

View file

@ -27,6 +27,11 @@ module ItemsHelper
end end
end end
def standard_species_images_key_for(item)
versions_count = 1 # TODO
"foo" # TODO
end
def standard_species_images_for(item) def standard_species_images_for(item)
build_on_pet_types(item.supported_species, item.special_color) do |pet_type| build_on_pet_types(item.supported_species, item.special_color) do |pet_type|
image = pet_type_image(pet_type, :happy, :face) image = pet_type_image(pet_type, :happy, :face)

View file

@ -192,8 +192,8 @@ class Item < ActiveRecord::Base
return Species.all if body_ids.include?(0) return Species.all if body_ids.include?(0)
pet_types = PetType.where(:body_id => body_ids).select([:species_id]) pet_types = PetType.where(:body_id => body_ids).select('DISTINCT species_id')
species_ids = pet_types.map(&:species_id).uniq species_ids = pet_types.map(&:species_id)
# If there are multiple known supported species, it probably supports them # If there are multiple known supported species, it probably supports them
# all. (I've never heard of only a handful of species being supported :P) # all. (I've never heard of only a handful of species being supported :P)

View file

@ -79,6 +79,7 @@
#item-preview #item-preview
#item-preview-species #item-preview-species
-# localized_cache random_standard_species_images_key do
= standard_species_images_for(@item) = standard_species_images_for(@item)
#item-preview-error #item-preview-error
#item-preview-swf= t '.preview.requirements_not_met' #item-preview-swf= t '.preview.requirements_not_met'