Remove unused logic for whether a zone is "sometimes" occupied
I'm about to reimplement the more-robust version of what this used to be: how the item page used to say "sometimes" after certain zones in the occupied list. Now, we're going to do parity with 2020, and list the actual species! I like that this takes away the weird `#sometimes` method on the `Zone` class, which was always an odd hack for just this small thing.
This commit is contained in:
parent
bd62476722
commit
8ab5af1aca
2 changed files with 3 additions and 25 deletions
|
@ -283,23 +283,9 @@ class Item < ApplicationRecord
|
|||
occupied_zones.map(&:id)
|
||||
end
|
||||
|
||||
def occupied_zones(options={})
|
||||
options[:scope] ||= Zone.all
|
||||
all_body_ids = []
|
||||
zone_body_ids = {}
|
||||
selected_assets = swf_assets.each do |swf_asset|
|
||||
zone_body_ids[swf_asset.zone_id] ||= []
|
||||
body_ids = zone_body_ids[swf_asset.zone_id]
|
||||
body_ids << swf_asset.body_id unless body_ids.include?(swf_asset.body_id)
|
||||
all_body_ids << swf_asset.body_id unless all_body_ids.include?(swf_asset.body_id)
|
||||
end
|
||||
zones = options[:scope].find(zone_body_ids.keys)
|
||||
zones_by_id = zones.inject({}) { |h, z| h[z.id] = z; h }
|
||||
total_body_ids = all_body_ids.size
|
||||
zone_body_ids.each do |zone_id, body_ids|
|
||||
zones_by_id[zone_id].sometimes = true if body_ids.size < total_body_ids
|
||||
end
|
||||
zones
|
||||
def occupied_zones
|
||||
zone_ids = swf_assets.map(&:zone_id).uniq
|
||||
Zone.find(zone_ids)
|
||||
end
|
||||
|
||||
def affected_zones
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
class Zone < ActiveRecord::Base
|
||||
# When selecting zones that an asset occupies, we allow the zone to set
|
||||
# whether or not the zone is "sometimes" occupied. This is false by default.
|
||||
attr_writer :sometimes
|
||||
|
||||
scope :alphabetical, -> { order(:label) }
|
||||
scope :matching_label, ->(label) {
|
||||
where(plain_label: Zone.plainify_label(label))
|
||||
|
@ -13,10 +9,6 @@ class Zone < ActiveRecord::Base
|
|||
super({only: [:id, :depth, :label]}.merge(options))
|
||||
end
|
||||
|
||||
def uncertain_label
|
||||
@sometimes ? "#{label} sometimes" : label
|
||||
end
|
||||
|
||||
def is_commonly_used_by_items
|
||||
# Zone metadata marks item zones with types 2, 3, and 4. But also, in
|
||||
# practice, the Biology Effects zone (type 1, ID 4) has been used for a few
|
||||
|
|
Loading…
Reference in a new issue