1
0
Fork 0
forked from OpenNeo/impress

Fix more modeling bugs

Just find_all_by's that I never cleaned up

Oddly enough, I still got a "neopets seems down" message out of this, idk if that's an actual bug or just sluggishness rn
This commit is contained in:
Emi Matchu 2023-10-12 18:57:39 -07:00
parent cbad00f32d
commit 3398439bae
2 changed files with 4 additions and 3 deletions

View file

@ -561,7 +561,8 @@ class Item < ApplicationRecord
# Collect existing relationships # Collect existing relationships
existing_relationships_by_item_id_and_swf_asset_id = {} existing_relationships_by_item_id_and_swf_asset_id = {}
existing_items = scope.find_all_by_id(item_ids, :include => :parent_swf_asset_relationships) existing_items = scope.where(id: item_ids).
include(:parent_swf_asset_relationships)
existing_items.each do |item| existing_items.each do |item|
items[item.id] = item items[item.id] = item
relationships_by_swf_asset_id = {} relationships_by_swf_asset_id = {}
@ -578,7 +579,7 @@ class Item < ApplicationRecord
swf_asset_ids << asset_id.to_i if asset_data swf_asset_ids << asset_id.to_i if asset_data
end end
existing_swf_assets = SwfAsset.object_assets.includes(:zone). existing_swf_assets = SwfAsset.object_assets.includes(:zone).
find_all_by_remote_id swf_asset_ids where(remote_id: swf_asset_ids)
existing_swf_assets_by_remote_id = {} existing_swf_assets_by_remote_id = {}
existing_swf_assets.each do |swf_asset| existing_swf_assets.each do |swf_asset|
existing_swf_assets_by_remote_id[swf_asset.remote_id] = swf_asset existing_swf_assets_by_remote_id[swf_asset.remote_id] = swf_asset

View file

@ -168,7 +168,7 @@ class PetState < ApplicationRecord
) )
end end
existing_swf_assets = SwfAsset.biology_assets.includes(:zone). existing_swf_assets = SwfAsset.biology_assets.includes(:zone).
find_all_by_remote_id(swf_asset_ids) where(remote_id: swf_asset_ids)
existing_swf_assets_by_id = {} existing_swf_assets_by_id = {}
existing_swf_assets.each do |swf_asset| existing_swf_assets.each do |swf_asset|
existing_swf_assets_by_id[swf_asset.remote_id] = swf_asset existing_swf_assets_by_id[swf_asset.remote_id] = swf_asset