diff --git a/be/algo-with-me-api/src/dashboard/dashboard.controller.ts b/be/algo-with-me-api/src/dashboard/dashboard.controller.ts index 72445683..e61e2a42 100644 --- a/be/algo-with-me-api/src/dashboard/dashboard.controller.ts +++ b/be/algo-with-me-api/src/dashboard/dashboard.controller.ts @@ -43,7 +43,7 @@ export class DashboardController { @ApiOperation({ summary: '[백엔드 테스트용] redis 대회 참가, 수정, 대시보드 조회 테스트' }) @Get('all/:competitionId') - async getDashboardTest(@Param('competitionId') competitionId: number = 5) { + async dashboardTest(@Param('competitionId') competitionId: number = 5) { await this.dashboardService.registerUserAtCompetition(competitionId, 'dhdgn@naver.com'); await this.dashboardService.registerUserAtCompetition(competitionId, 'qwer@naver.com'); await this.dashboardService.updateUserSubmission( @@ -53,7 +53,13 @@ export class DashboardController { RESULT.CORRECT, new Date(), ); - await this.dashboardService.getTop100DashboardRedis(5, 'dhdgn@naver.com'); + await this.dashboardService.getTop100DashboardRedis(competitionId, 'dhdgn@naver.com'); + } + + @ApiOperation({ summary: '[백엔드 테스트용] 대시보드 조회 테스트' }) + @Get('test/:competitionId') + async getDashboardTest(@Param('competitionId') competitionId: number = 5) { + return await this.dashboardService.getTop100DashboardRedis(competitionId, 'dhdgn@naver.com'); } @ApiOperation({ summary: '대회 종료 이후 대시보드 조회' }) diff --git a/be/algo-with-me-api/src/dashboard/dashboard.service.ts b/be/algo-with-me-api/src/dashboard/dashboard.service.ts index 8d8edfa1..102c0156 100644 --- a/be/algo-with-me-api/src/dashboard/dashboard.service.ts +++ b/be/algo-with-me-api/src/dashboard/dashboard.service.ts @@ -165,6 +165,9 @@ export class DashboardService { rankings.push({ email: scores[i], score: scores[i + 1] }); emails.push(scoreKey + ':' + scores[i]); } + + if (emails.length === 0) return { rankings, emails }; + const problems = await this.redis.mget(emails); this.logger.debug(problems); for (const [idx, ranking] of rankings.entries()) {