Skip to content

Commit

Permalink
fix: filtering edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jan 4, 2024
1 parent d6f04e0 commit a1b1580
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions server/src/models/Pokemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/filters/pokemon/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a1b1580

Please sign in to comment.