From a1b15806af30314dd90712f10180508ab75f7ebd Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Wed, 3 Jan 2024 21:09:16 -0500 Subject: [PATCH] fix: filtering edge cases --- server/src/models/Pokemon.js | 13 +++++-------- server/src/services/filters/pokemon/Backend.js | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/server/src/models/Pokemon.js b/server/src/models/Pokemon.js index b654d1cd8..bd86925af 100644 --- a/server/src/models/Pokemon.js +++ b/server/src/models/Pokemon.js @@ -257,16 +257,13 @@ class Pokemon extends Model { ) { filters.push(...globalFilter.buildApiFilter(pokemon)) } + const globalPokes = globalFilter.mods.onlyLinkGlobal + ? [...pokemon, { id: -1 }] + : pokemon if (onlyZeroIv) - filters.push({ - iv: { min: 0, max: 0 }, - pokemon: globalFilter.mods.onlyLinkGlobal ? [{ id: -1 }] : pokemon, - }) + filters.push({ iv: { min: 0, max: 0 }, pokemon: globalPokes }) if (onlyHundoIv) - filters.push({ - iv: { min: 100, max: 100 }, - pokemon: globalFilter.mods.onlyLinkGlobal ? [{ id: -1 }] : pokemon, - }) + filters.push({ iv: { min: 100, max: 100 }, pokemon: globalPokes }) } /** @type {import("../types").Pokemon[]} */ const results = await this.evalQuery( diff --git a/server/src/services/filters/pokemon/Backend.js b/server/src/services/filters/pokemon/Backend.js index b845eb3a6..f6a924466 100644 --- a/server/src/services/filters/pokemon/Backend.js +++ b/server/src/services/filters/pokemon/Backend.js @@ -144,7 +144,7 @@ module.exports = class PkmnBackend { if (merged) merged = `(${merged})&` merged += `G${filter.gender}` } - log.debug(HELPERS.pokemon, this.id, { + log.trace(HELPERS.pokemon, this.id, { andStr, orStr, merged,