From 2929c3373eba2fd1f4dbdf961f38ccc078d6259e Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 31 Aug 2020 00:37:12 -0700 Subject: [PATCH] serve glitched appearances, only if no others MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, I was filtering out glitched appearances from the canonical ones. But now, I'm thinking it's better to serve glitched ones than no data for a pose at all. I'm inspired by the case of the Candy Acara, which has _only_ glitched appearances in our db, and I'd like to mark them for reference—but then the site would treat it as no data at all. --- src/server/index.js | 4 +--- src/server/loaders.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/index.js b/src/server/index.js index cb58f80..a238598 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -595,9 +595,7 @@ const resolvers = { // TODO: We could query for this more directly, instead of loading all // appearances 🤔 const petStates = await petStatesForPetTypeLoader.load(petType.id); - const petState = petStates.find( - (ps) => getPoseFromPetState(ps) === pose && !ps.glitched - ); + const petState = petStates.find((ps) => getPoseFromPetState(ps) === pose); if (!petState) { return null; } diff --git a/src/server/loaders.js b/src/server/loaders.js index 8185c69..8323a2d 100644 --- a/src/server/loaders.js +++ b/src/server/loaders.js @@ -356,7 +356,7 @@ const buildPetStatesForPetTypeLoader = (db, loaders) => `SELECT * FROM pet_states WHERE pet_type_id IN (${qs}) ORDER BY (mood_id IS NULL) ASC, mood_id ASC, female DESC, - unconverted DESC, id DESC`, + unconverted DESC, glitched ASC, id DESC`, petTypeIds );