From b1015c9a5c327a75992557b16d6ac551e71f4385 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 27 Jan 2011 17:50:08 -0500 Subject: [PATCH] species check was in the wrong place. fixed --- app/models/roulette.rb | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/models/roulette.rb b/app/models/roulette.rb index bb24e640..04c4ab66 100644 --- a/app/models/roulette.rb +++ b/app/models/roulette.rb @@ -37,11 +37,11 @@ class Roulette used_swf_asset_ids.push(swf_asset.id) swf_asset.object_asset_relationships.each do |rel| item = rel.item - pass = true - item.affected_zones.each do |zone| - checked_zone_id = zone.id - next if checked_zone_id == zone_id - if item.species_support_ids.empty? || item.species_support_ids.include?(@pet_type.species_id) + if item.species_support_ids.empty? || item.species_support_ids.include?(@pet_type.species_id) + pass = true + item.affected_zones.each do |zone| + checked_zone_id = zone.id + next if checked_zone_id == zone_id if i = unoccupied_zone_ids.find_index(zone_id) unoccupied_zone_ids.delete zone_id else @@ -49,16 +49,13 @@ class Roulette pass = false break end - else - pass = false + end + if pass + found_item = true + @item_ids << item.id break end end - if pass - found_item = true - @item_ids << item.id - break - end end break if found_item end