Skip to content

Commit

Permalink
fix(be): ignore submissions for problems not included in contest (#2223)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeon1020 authored Nov 20, 2024
1 parent 7a7ffd0 commit 0e09b52
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/backend/apps/admin/src/contest/contest.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ export class ContestService {
* 특정 user의 특정 Contest에 대한 총점, 통과한 문제 개수와 각 문제별 테스트케이스 통과 개수를 불러옵니다.
*/
async getContestScoreSummary(userId: number, contestId: number) {
const [contestProblems, submissions] = await Promise.all([
const [contestProblems, rawSubmissions] = await Promise.all([
this.prisma.contestProblem.findMany({
where: {
contestId
Expand All @@ -716,6 +716,14 @@ export class ContestService {
})
])

// 오직 현재 Contest에 남아있는 문제들의 제출에 대해서만 ScoreSummary 계산
const contestProblemIds = contestProblems.map(
(contestProblem) => contestProblem.problemId
)
const submissions = rawSubmissions.filter((submission) =>
contestProblemIds.includes(submission.problemId)
)

if (!submissions.length) {
return {
submittedProblemCount: 0,
Expand Down

0 comments on commit 0e09b52

Please sign in to comment.