Skip to content

Commit

Permalink
fix: showcase filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Jan 27, 2024
1 parent fe93cfc commit 8c9d08a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions server/src/models/Pokestop.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,15 @@ class Pokestop extends Model {
const general = []
const rocketPokemon = []
const displayTypes = []
let hasShowcase = false
// preps arrays for interested objects
Object.keys(args.filters).forEach((pokestop) => {
switch (pokestop.charAt(0)) {
case 'o':
break
case 'f':
case 'h':
// do nothing
hasShowcase = true
break
case 'd':
stardust.push(pokestop.slice(1).split('-')[0])
Expand Down Expand Up @@ -254,6 +255,7 @@ class Pokestop extends Model {
break
}
})
if (hasShowcase) displayTypes.push('9')

// builds the query
query.andWhere((stops) => {
Expand Down Expand Up @@ -705,8 +707,8 @@ class Pokestop extends Model {
.filter((event) =>
isMad && !hasMultiInvasions
? MADE_UP_MAD_INVASIONS.includes(event.grunt_type) ||
(!event.grunt_type && filters[`b${event.display_type}`])
: !event.grunt_type && filters[`b${event.display_type}`],
!event.grunt_type
: !event.grunt_type,
)
.map((event) => ({
event_expire_timestamp: event.incident_expire_timestamp,
Expand Down Expand Up @@ -739,7 +741,7 @@ class Pokestop extends Model {
]
: event.showcase_pokemon_type_id
? filters[`h${event.showcase_pokemon_type_id}`]
: true,
: filters[`b${event.display_type}`],
)
}
if (
Expand Down

0 comments on commit 8c9d08a

Please sign in to comment.