From 7f0d56494a94affe449948794773983057d71104 Mon Sep 17 00:00:00 2001
From: ReuschelCGN <82573872+ReuschelCGN@users.noreply.github.com>
Date: Wed, 2 Oct 2024 15:10:45 +0200
Subject: [PATCH 1/3] add end time to Station.js
---
server/src/models/Station.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server/src/models/Station.js b/server/src/models/Station.js
index bd2a92bb0..342b8c350 100644
--- a/server/src/models/Station.js
+++ b/server/src/models/Station.js
@@ -62,6 +62,7 @@ class Station extends Model {
query
.whereNotNull('battle_pokemon_id')
.andWhere('is_battle_available', true)
+ .andWhere('battle_end', '>', ts)
if (onlyBattleTier === 'all') {
const battleBosses = new Set()
@@ -159,9 +160,11 @@ class Station extends Model {
static async getAvailable() {
/** @type {import('@rm/types').FullStation[]} */
+ const ts = getEpoch()
const results = await this.query()
.distinct(['battle_pokemon_id', 'battle_pokemon_form', 'battle_level'])
.where('is_inactive', false)
+ .andWhere('end_time', '>', ts)
.groupBy(['battle_pokemon_id', 'battle_pokemon_form', 'battle_level'])
.orderBy('battle_pokemon_id', 'asc')
return {
@@ -191,6 +194,7 @@ class Station extends Model {
const { areaRestrictions } = perms
const { onlyAreas = [], search = '', locale } = args
const { searchResultsLimit, stationUpdateLimit } = config.getSafe('api')
+ const ts = getEpoch()
const pokemonIds = Object.keys(state.event.masterfile.pokemon).filter(
(pkmn) =>
@@ -222,6 +226,7 @@ class Station extends Model {
'>',
Date.now() / 1000 - stationUpdateLimit * 60 * 60 * 24,
)
+ .andWhere('end_time', '>', ts)
.andWhere((builder) => {
if (perms.stations) {
builder.orWhereILike('name', `%${search}%`)
@@ -231,6 +236,7 @@ class Station extends Model {
builder2
.whereIn('battle_pokemon_id', pokemonIds)
.andWhere('is_battle_available', true)
+ .andWhere('battle_end', '>', ts)
})
}
})
From 62b7b48fcb2a808705adb596fd49a615bfb90dd8 Mon Sep 17 00:00:00 2001
From: ReuschelCGN <82573872+ReuschelCGN@users.noreply.github.com>
Date: Wed, 2 Oct 2024 15:12:58 +0200
Subject: [PATCH 2/3] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index af0245d70..ca025f1ac 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@