@@ -62,6 +62,7 @@ class Station extends Model {
62
62
query
63
63
. whereNotNull ( 'battle_pokemon_id' )
64
64
. andWhere ( 'is_battle_available' , true )
65
+ . andWhere ( 'battle_end' , '>' , ts )
65
66
66
67
if ( onlyBattleTier === 'all' ) {
67
68
const battleBosses = new Set ( )
@@ -159,9 +160,11 @@ class Station extends Model {
159
160
160
161
static async getAvailable ( ) {
161
162
/** @type {import('@rm/types').FullStation[] } */
163
+ const ts = getEpoch ( )
162
164
const results = await this . query ( )
163
165
. distinct ( [ 'battle_pokemon_id' , 'battle_pokemon_form' , 'battle_level' ] )
164
166
. where ( 'is_inactive' , false )
167
+ . andWhere ( 'end_time' , '>' , ts )
165
168
. groupBy ( [ 'battle_pokemon_id' , 'battle_pokemon_form' , 'battle_level' ] )
166
169
. orderBy ( 'battle_pokemon_id' , 'asc' )
167
170
return {
@@ -191,6 +194,7 @@ class Station extends Model {
191
194
const { areaRestrictions } = perms
192
195
const { onlyAreas = [ ] , search = '' , locale } = args
193
196
const { searchResultsLimit, stationUpdateLimit } = config . getSafe ( 'api' )
197
+ const ts = getEpoch ( )
194
198
195
199
const pokemonIds = Object . keys ( state . event . masterfile . pokemon ) . filter (
196
200
( pkmn ) =>
@@ -222,6 +226,7 @@ class Station extends Model {
222
226
'>' ,
223
227
Date . now ( ) / 1000 - stationUpdateLimit * 60 * 60 * 24 ,
224
228
)
229
+ . andWhere ( 'end_time' , '>' , ts )
225
230
. andWhere ( ( builder ) => {
226
231
if ( perms . stations ) {
227
232
builder . orWhereILike ( 'name' , `%${ search } %` )
@@ -231,6 +236,7 @@ class Station extends Model {
231
236
builder2
232
237
. whereIn ( 'battle_pokemon_id' , pokemonIds )
233
238
. andWhere ( 'is_battle_available' , true )
239
+ . andWhere ( 'battle_end' , '>' , ts )
234
240
} )
235
241
}
236
242
} )
0 commit comments