Skip to content

Commit 14971bc

Browse files
authored
Update Station.js
1 parent 4fb0199 commit 14971bc

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

server/src/models/Station.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,16 @@ class Station extends Model {
6262
query.andWhere(
6363
'updated',
6464
'>',
65-
Date.now() / 1000 - stationUpdateLimit * 60 * 60
65+
Date.now() / 1000 - stationUpdateLimit * 60 * 60,
6666
)
6767
}
6868
// .where('is_inactive', false)
6969

70-
if (!onlyInactiveStations && perms.dynamax && (onlyMaxBattles || onlyGmaxStationed)) {
70+
if (
71+
!onlyInactiveStations &&
72+
perms.dynamax &&
73+
(onlyMaxBattles || onlyGmaxStationed)
74+
) {
7175
select.push(
7276
'is_battle_available',
7377
'battle_level',
@@ -84,13 +88,11 @@ class Station extends Model {
8488
'total_stationed_pokemon',
8589
)
8690
select.push(
87-
hasStationedGmax ? 'total_stationed_gmax' : 'stationed_pokemon'
91+
hasStationedGmax ? 'total_stationed_gmax' : 'stationed_pokemon',
8892
)
8993

9094
if (!onlyAllStations) {
91-
query
92-
.whereNotNull('battle_pokemon_id')
93-
.andWhere('battle_end', '>', ts)
95+
query.whereNotNull('battle_pokemon_id').andWhere('battle_end', '>', ts)
9496

9597
query.andWhere((station) => {
9698
if (hasStationedGmax || !onlyGmaxStationed) {
@@ -178,7 +180,7 @@ class Station extends Model {
178180
`${station.battle_pokemon_id}-${station.battle_pokemon_form}`
179181
]
180182
: onlyBattleTier === station.battle_level)) ||
181-
(onlyGmaxStationed && station.total_stationed_gmax)))
183+
(onlyGmaxStationed && station.total_stationed_gmax))),
182184
)
183185
}
184186

@@ -221,9 +223,9 @@ class Station extends Model {
221223
.andWhere(
222224
'updated',
223225
'>',
224-
Date.now() / 1000 - stationUpdateLimit * 60 * 60
226+
Date.now() / 1000 - stationUpdateLimit * 60 * 60,
225227
)
226-
.groupBy(['battle_pokemon_id', 'battle_pokemon_form', 'battle_level'])
228+
.groupBy(['battle_pokemon_id', 'battle_pokemon_form', 'battle_level'])
227229
.orderBy('battle_pokemon_id', 'asc')
228230
return {
229231
available: [
@@ -233,7 +235,7 @@ class Station extends Model {
233235
.flatMap((station) => [
234236
`${station.battle_pokemon_id}-${station.battle_pokemon_form}`,
235237
`j${station.battle_level}`,
236-
])
238+
]),
237239
),
238240
],
239241
}
@@ -283,7 +285,7 @@ class Station extends Model {
283285
.andWhere(
284286
'updated',
285287
'>',
286-
Date.now() / 1000 - stationUpdateLimit * 60 * 60
288+
Date.now() / 1000 - stationUpdateLimit * 60 * 60,
287289
)
288290
.andWhere('end_time', '>', ts)
289291
.andWhere((builder) => {

0 commit comments

Comments
 (0)