From bed3cf7227561708a88fd9af7e89b8701279a7a9 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Sat, 25 Apr 2020 04:43:54 -0700 Subject: [PATCH] prefer nicer pet states --- src/server/index.test.js | 20 +++++++------------- src/server/loaders.js | 3 ++- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/server/index.test.js b/src/server/index.test.js index df54aab..95d7093 100644 --- a/src/server/index.test.js +++ b/src/server/index.test.js @@ -305,22 +305,15 @@ describe("PetAppearance", () => { }, }, Object { - "id": "19549", - "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28548/600x600.png?v2-1345719457000", + "id": "19784", + "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28892/600x600.png?v2-1313418652000", "zone": Object { "depth": 37, }, }, Object { - "id": "19550", - "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-0", - "zone": Object { - "depth": 38, - }, - }, - Object { - "id": "163528", - "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/028/28549/600x600.png?v2-1326455337000", + "id": "178150", + "imageUrl": "https://impress-asset-images.s3.amazonaws.com/biology/000/000/036/36887/600x600.png?v2-1354240708000", "zone": Object { "depth": 38, }, @@ -339,7 +332,8 @@ describe("PetAppearance", () => { ], ], Array [ - "SELECT * FROM pet_states WHERE pet_type_id IN (?)", + "SELECT * FROM pet_states WHERE pet_type_id IN (?) + ORDER BY glitched ASC, (mood_id = 1) DESC", Array [ "2", ], @@ -351,7 +345,7 @@ describe("PetAppearance", () => { rel.swf_asset_id = sa.id WHERE rel.parent_id IN (?)", Array [ - "2", + "17723", ], ], Array [ diff --git a/src/server/loaders.js b/src/server/loaders.js index b5a071a..adc1b0a 100644 --- a/src/server/loaders.js +++ b/src/server/loaders.js @@ -229,7 +229,8 @@ const buildPetStateLoader = (db) => new DataLoader(async (petTypeIds) => { const qs = petTypeIds.map((_) => "?").join(","); const [rows, _] = await db.execute( - `SELECT * FROM pet_states WHERE pet_type_id IN (${qs})`, + `SELECT * FROM pet_states WHERE pet_type_id IN (${qs}) + ORDER BY glitched ASC, (mood_id = 1) DESC`, petTypeIds );