Remove more unused SwfAsset scopes

Wowzers, a lot of cruft in here! I hope I'm not deleting anything
important, but I think my Ctrl-F audits are checking out?
This commit is contained in:
Emi Matchu 2024-02-24 15:19:28 -08:00
parent 7fee4e6e41
commit e8737a520e

View file

@ -17,8 +17,6 @@ class SwfAsset < ApplicationRecord
belongs_to :zone belongs_to :zone
has_many :parent_swf_asset_relationships has_many :parent_swf_asset_relationships
scope :includes_depth, -> { includes(:zone) }
before_validation :normalize_manifest_url, if: :manifest_url? before_validation :normalize_manifest_url, if: :manifest_url?
PARTITION_COUNT = 3 PARTITION_COUNT = 3
@ -51,28 +49,8 @@ class SwfAsset < ApplicationRecord
delegate :depth, :to => :zone delegate :depth, :to => :zone
scope :fitting_body_id, ->(body_id) {
where(arel_table[:body_id].in([body_id, 0]))
}
scope :fitting_color, ->(color) {
body_ids = PetType.select(:body_id).where(:color_id => color.id).map(&:body_id)
body_ids << 0
where(arel_table[:body_id].in(body_ids))
}
scope :biology_assets, -> { where(:type => PetState::SwfAssetType) } scope :biology_assets, -> { where(:type => PetState::SwfAssetType) }
scope :object_assets, -> { where(:type => Item::SwfAssetType) } scope :object_assets, -> { where(:type => Item::SwfAssetType) }
scope :for_item_ids, ->(item_ids) {
joins(:parent_swf_asset_relationships).
where(parent_swf_asset_relationships: {
parent_type: "Item",
parent_id: item_ids,
})
}
scope :with_parent_ids, -> {
select('swf_assets.*, parents_swf_assets.parent_id')
}
# To manually change the body ID without triggering the usual change to 0, # To manually change the body ID without triggering the usual change to 0,
# use this override method. # use this override method.