@@ -55,14 +55,14 @@ class Station extends Model {
5555 maxLon : args . maxLon ,
5656 } ,
5757 } )
58- if ( ! ( onlyAllStations && onlyInactiveStations ) ) {
58+ if ( ! onlyAllStations || ! onlyInactiveStations ) {
5959 query . andWhere ( 'end_time' , onlyInactiveStations ? '<' : '>' , ts )
6060 }
6161 if ( ! onlyInactiveStations && ! onlyAllStations ) {
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)
@@ -81,17 +81,19 @@ class Station extends Model {
8181 'battle_pokemon_bread_mode' ,
8282 'battle_pokemon_move_1' ,
8383 'battle_pokemon_move_2' ,
84- 'total_stationed_pokemon' ,
84+ 'total_stationed_pokemon'
8585 )
8686 select . push (
87- hasStationedGmax ? 'total_stationed_gmax' : 'stationed_pokemon' ,
87+ hasStationedGmax ? 'total_stationed_gmax' : 'stationed_pokemon'
8888 )
8989
9090 if ( ! onlyAllStations ) {
91- query . whereNotNull ( 'battle_pokemon_id' ) . andWhere ( 'battle_end' , '>' , ts )
91+ query
92+ . whereNotNull ( 'battle_pokemon_id' )
93+ . andWhere ( 'battle_end' , '>' , ts )
9294
9395 query . andWhere ( ( station ) => {
94- if ( hasStationedGmax || ! onlyGmaxStationed )
96+ if ( hasStationedGmax || ! onlyGmaxStationed ) {
9597 station . where ( ( battle ) => {
9698 if ( onlyBattleTier === 'all' ) {
9799 const battleBosses = new Set ( )
@@ -105,13 +107,11 @@ class Station extends Model {
105107 case 'j' :
106108 battleLevels . add ( key . slice ( 1 ) )
107109 break
108- default :
109- {
110- const [ id , form ] = key . split ( '-' )
111- if ( id ) battleBosses . add ( id )
112- if ( form ) battleForms . add ( form )
113- }
114- break
110+ default : {
111+ const [ id , form ] = key . split ( '-' )
112+ if ( id ) battleBosses . add ( id )
113+ if ( form ) battleForms . add ( form )
114+ }
115115 }
116116 } )
117117 if ( battleBosses . size ) {
@@ -127,8 +127,10 @@ class Station extends Model {
127127 battle . andWhere ( 'battle_level' , onlyBattleTier )
128128 }
129129 } )
130- if ( hasStationedGmax && onlyGmaxStationed )
130+ }
131+ if ( hasStationedGmax && onlyGmaxStationed ) {
131132 station . orWhere ( 'total_stationed_gmax' , '>' , 0 )
133+ }
132134 } )
133135 }
134136 }
@@ -176,7 +178,7 @@ class Station extends Model {
176178 `${ station . battle_pokemon_id } -${ station . battle_pokemon_form } `
177179 ]
178180 : onlyBattleTier === station . battle_level ) ) ||
179- ( onlyGmaxStationed && station . total_stationed_gmax ) ) ) ,
181+ ( onlyGmaxStationed && station . total_stationed_gmax ) ) )
180182 )
181183 }
182184
@@ -219,9 +221,9 @@ class Station extends Model {
219221 . andWhere (
220222 'updated' ,
221223 '>' ,
222- Date . now ( ) / 1000 - stationUpdateLimit * 60 * 60 ,
224+ Date . now ( ) / 1000 - stationUpdateLimit * 60 * 60
223225 )
224- . groupBy ( [ 'battle_pokemon_id' , 'battle_pokemon_form' , 'battle_level' ] )
226+ . groupBy ( [ 'battle_pokemon_id' , 'battle_pokemon_form' , 'battle_level' ] )
225227 . orderBy ( 'battle_pokemon_id' , 'asc' )
226228 return {
227229 available : [
@@ -231,7 +233,7 @@ class Station extends Model {
231233 . flatMap ( ( station ) => [
232234 `${ station . battle_pokemon_id } -${ station . battle_pokemon_form } ` ,
233235 `j${ station . battle_level } ` ,
234- ] ) ,
236+ ] )
235237 ) ,
236238 ] ,
237239 }
@@ -281,7 +283,7 @@ class Station extends Model {
281283 . andWhere (
282284 'updated' ,
283285 '>' ,
284- Date . now ( ) / 1000 - stationUpdateLimit * 60 * 60 ,
286+ Date . now ( ) / 1000 - stationUpdateLimit * 60 * 60
285287 )
286288 . andWhere ( 'end_time' , '>' , ts )
287289 . andWhere ( ( builder ) => {
0 commit comments