diff --git a/backend/src/app.ts b/backend/src/app.ts index 70ded53..c638703 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -15,12 +15,19 @@ app.get('/', (req, res) => { }) app.post('/api/serverstats/gamestats', jsonParser, async (req, res) => { + let startSeconds = 0 + let endSeconds = Number.MAX_SAFE_INTEGER - const month = req.body.monthId % 12 - const year = Math.floor(req.body.monthId / 12) + 2023 + if (req.body.monthId != -1) { + const month = req.body.monthId % 12 + const year = Math.floor(req.body.monthId / 12) + 2023 - const startDate = new Date(year, month, 1) - const endDate = new Date(year, month + 1, -1) + const startDate = new Date(year, month, 1) + const endDate = new Date(year, month + 1, -1) + + startSeconds = startDate.getTime() / 1000 + endSeconds = endDate.getTime() / 1000 + } const serverGameStats = await database.query( 'SELECT ' + @@ -34,8 +41,8 @@ app.post('/api/serverstats/gamestats', jsonParser, async (req, res) => { { type: QueryTypes.SELECT, replacements: { - startSeconds: startDate.getTime() / 1000, - endSeconds: endDate.getTime() / 1000 + startSeconds, + endSeconds } } ) diff --git a/frontend/src/vues/ServerStats.vue b/frontend/src/vues/ServerStats.vue index 34055a2..ae33a74 100644 --- a/frontend/src/vues/ServerStats.vue +++ b/frontend/src/vues/ServerStats.vue @@ -1,41 +1,41 @@ @@ -51,7 +51,8 @@