From da88f849955925ff8630733da96b0c85b4f0867a Mon Sep 17 00:00:00 2001 From: benno Date: Sat, 22 Jan 2022 11:22:38 +0100 Subject: [PATCH] updated highscore query --- client/src/ui/pages/dronieslab/index.tsx | 2 +- server/src/services/games/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/ui/pages/dronieslab/index.tsx b/client/src/ui/pages/dronieslab/index.tsx index 0cc4e28..a95a333 100644 --- a/client/src/ui/pages/dronieslab/index.tsx +++ b/client/src/ui/pages/dronieslab/index.tsx @@ -19,7 +19,7 @@ const FlappyDronieScreen: React.FC = () => ( - + ); diff --git a/server/src/services/games/index.ts b/server/src/services/games/index.ts index 5145ab2..0df1fa4 100644 --- a/server/src/services/games/index.ts +++ b/server/src/services/games/index.ts @@ -49,6 +49,7 @@ export async function getRecentHighScores( .from(GameLog, 'sub_gameLog') .select('MAX("score")', 'max_score') .addSelect('player_id') + .where('game_type = :gameType', { gameType }) .groupBy('player_id'), 'best_game', 'best_game.player_id = gameLog.player_id', // = ON best_game.player_id = gameLog.player_id @@ -56,7 +57,6 @@ export async function getRecentHighScores( // https://stackoverflow.com/questions/65644410/typeorm-leftjoin-with-3-tables .leftJoinAndSelect('gameLog.player', 'user', 'user.id = gameLog.player_id') .where('best_game.max_score = gameLog.score') - .andWhere('gameLog.game_type = :gameType', { gameType }) .andWhere('gameLog.played_at > :date', { date: endIncludeDate }) .distinctOn(['gameLog.score']) // https://stackoverflow.com/questions/3800551/select-first-row-in-each-group-by-group .orderBy('gameLog.score', 'DESC')