From 8cdc8c3b6c94e77bf7074567101f60817fd862ab Mon Sep 17 00:00:00 2001 From: jrandiny Date: Thu, 25 Feb 2021 23:18:36 +0700 Subject: [PATCH] Fix rank count --- src/controller/UserController.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/controller/UserController.ts b/src/controller/UserController.ts index 80f6c0f..209b954 100644 --- a/src/controller/UserController.ts +++ b/src/controller/UserController.ts @@ -502,12 +502,9 @@ export class UserController { } } - const totalCount = await this.globalScoreboardRepository - .createQueryBuilder("leaderboard") - .select("COUNT(DISTINCT(score)) AS total") - .getRawOne(); + const totalCount = await this.globalScoreboardRepository.count(); - return responseGenerator(response, 200, "ok", { score, rank, total: totalCount.total }); + return responseGenerator(response, 200, "ok", { score, rank, total: totalCount }); } catch (err) { console.error(err);