From 846262e1d1acee1e7d664a596765eef165f2f460 Mon Sep 17 00:00:00 2001 From: Eunsu Kang <56429615+ssupecial@users.noreply.github.com> Date: Sun, 1 Sep 2024 14:44:23 +0900 Subject: [PATCH 1/6] feat(infra): increase api asg desired capacity and ecs client service desired count (#2054) * feat(infra): increase api asg desired capacity from 1 to 2 * feat(infra): increase ecs api client service from 1 to 2 * feat(infra): set min capacity of client ecs service to 2 --- apps/infra/production/codedang/codedang_api.tf | 5 +++-- apps/infra/production/codedang/codedang_iris.tf | 5 +++-- apps/infra/production/codedang/codedang_service_client.tf | 4 ++-- .../codedang/modules/cluster_autoscaling/autoscaling.tf | 2 +- .../codedang/modules/cluster_autoscaling/variables.tf | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/infra/production/codedang/codedang_api.tf b/apps/infra/production/codedang/codedang_api.tf index b39282e00a..d8bf00e015 100644 --- a/apps/infra/production/codedang/codedang_api.tf +++ b/apps/infra/production/codedang/codedang_api.tf @@ -9,8 +9,9 @@ module "codedang_api" { } autoscaling_group = { - name = "Codedang-AutoScalingGroup-Api" - max_size = 10 + name = "Codedang-AutoScalingGroup-Api" + max_size = 10 + desired_capacity = 2 } autoscaling_policy = { diff --git a/apps/infra/production/codedang/codedang_iris.tf b/apps/infra/production/codedang/codedang_iris.tf index 4dd25699fb..17820d3edd 100644 --- a/apps/infra/production/codedang/codedang_iris.tf +++ b/apps/infra/production/codedang/codedang_iris.tf @@ -10,8 +10,9 @@ module "codedang_iris" { } autoscaling_group = { - name = "Codedang-AutoScalingGroup-Iris" - max_size = 4 + name = "Codedang-AutoScalingGroup-Iris" + max_size = 4 + desired_capacity = 1 } autoscaling_policy = { diff --git a/apps/infra/production/codedang/codedang_service_client.tf b/apps/infra/production/codedang/codedang_service_client.tf index 2080dd9e3a..b910c57d1a 100644 --- a/apps/infra/production/codedang/codedang_service_client.tf +++ b/apps/infra/production/codedang/codedang_service_client.tf @@ -85,7 +85,7 @@ module "client_api" { ecs_service = { name = "Codedang-Client-Api-Service" cluster_arn = module.codedang_api.ecs_cluster.arn - desired_count = 1 + desired_count = 2 load_balancer = { container_name = "Codedang-Client-Api" container_port = 4000 @@ -94,7 +94,7 @@ module "client_api" { } appautoscaling_target = { - min_capacity = 1 + min_capacity = 2 max_capacity = 8 resource_id = { cluster_name = module.codedang_api.ecs_cluster.name diff --git a/apps/infra/production/codedang/modules/cluster_autoscaling/autoscaling.tf b/apps/infra/production/codedang/modules/cluster_autoscaling/autoscaling.tf index d25a9a03cb..f6b8de536c 100644 --- a/apps/infra/production/codedang/modules/cluster_autoscaling/autoscaling.tf +++ b/apps/infra/production/codedang/modules/cluster_autoscaling/autoscaling.tf @@ -28,7 +28,7 @@ resource "aws_autoscaling_group" "this" { name = var.autoscaling_group.name vpc_zone_identifier = [for key in keys(var.subnets) : aws_subnet.this[key].id] - desired_capacity = 1 + desired_capacity = var.autoscaling_group.desired_capacity min_size = 1 max_size = var.autoscaling_group.max_size diff --git a/apps/infra/production/codedang/modules/cluster_autoscaling/variables.tf b/apps/infra/production/codedang/modules/cluster_autoscaling/variables.tf index 3a962bd064..3d9919d9db 100644 --- a/apps/infra/production/codedang/modules/cluster_autoscaling/variables.tf +++ b/apps/infra/production/codedang/modules/cluster_autoscaling/variables.tf @@ -11,8 +11,9 @@ variable "launch_template" { variable "autoscaling_group" { type = object({ - name = string - max_size = number + name = string + max_size = number + desired_capacity = number }) description = "The autoscaling group. e.g. {name='codedang-asg', max_size=7}" } From e1ff8b4dd8caf3f6050ec59c3b942eea87578665 Mon Sep 17 00:00:00 2001 From: Jaehyeon Kim Date: Sun, 1 Sep 2024 17:29:17 +0900 Subject: [PATCH 2/6] docs(be): add docs for contest overall apis (#2052) --- .../admin/src/contest/contest.resolver.ts | 33 ++++------ .../src/submission/submission.resolver.ts | 6 ++ .../Get Contest Score Summaries /Succeed.bru | 65 ------------------- .../Succeed.bru | 7 +- .../Succeed.bru | 8 +++ .../Succeed.bru | 1 + 6 files changed, 33 insertions(+), 87 deletions(-) delete mode 100644 collection/admin/Contest/Get Contest Score Summaries /Succeed.bru rename collection/admin/Contest/{Get Contest Submission Summaries of User => Get Contest Submission Summaries of Users}/Succeed.bru (77%) diff --git a/apps/backend/apps/admin/src/contest/contest.resolver.ts b/apps/backend/apps/admin/src/contest/contest.resolver.ts index 89772e4bd5..cde7c5b7fb 100644 --- a/apps/backend/apps/admin/src/contest/contest.resolver.ts +++ b/apps/backend/apps/admin/src/contest/contest.resolver.ts @@ -30,10 +30,7 @@ import { DuplicatedContestResponse } from './model/duplicated-contest-response.o import { ProblemScoreInput } from './model/problem-score.input' import { PublicizingRequest } from './model/publicizing-request.model' import { PublicizingResponse } from './model/publicizing-response.output' -import { - UserContestScoreSummary, - UserContestScoreSummaryWithUserInfo -} from './model/score-summary' +import { UserContestScoreSummaryWithUserInfo } from './model/score-summary' @Resolver(() => Contest) export class ContestResolver { @@ -233,6 +230,12 @@ export class ContestResolver { } } + /** + * 특정 User의 Contest 제출 내용 요약 정보를 가져옵니다. + * + * Contest Overall 페이지에서 특정 유저를 선택했을 때 사용 + * https://github.com/skkuding/codedang/pull/1894 + */ @Query(() => ContestSubmissionSummaryForUser) async getContestSubmissionSummaryByUserId( @Args('contestId', { type: () => Int }, IDValidationPipe) contestId: number, @@ -287,22 +290,12 @@ export class ContestResolver { } } - @Query(() => UserContestScoreSummary) - async getContestScoreSummary( - @Args('userId', { type: () => Int }) userId: number, - @Args('contestId', { type: () => Int }) contestId: number - ) { - try { - return await this.contestService.getContestScoreSummary(userId, contestId) - } catch (error) { - if (error instanceof EntityNotExistException) { - throw error.convert2HTTPException() - } - this.logger.error(error) - throw new InternalServerErrorException() - } - } - + /** + * Contest에 참여한 User와, 점수 요약을 함께 불러옵니다. + * + * Contest Overall 페이지의 Participants 탭의 정보 + * https://github.com/skkuding/codedang/pull/2029 + */ @Query(() => [UserContestScoreSummaryWithUserInfo]) async getContestScoreSummaries( @Args('take', { type: () => Int, defaultValue: 10 }) take: number, diff --git a/apps/backend/apps/admin/src/submission/submission.resolver.ts b/apps/backend/apps/admin/src/submission/submission.resolver.ts index 26a67b72de..29d3d45291 100644 --- a/apps/backend/apps/admin/src/submission/submission.resolver.ts +++ b/apps/backend/apps/admin/src/submission/submission.resolver.ts @@ -11,6 +11,12 @@ export class SubmissionResolver { private readonly logger = new Logger(SubmissionResolver.name) constructor(private readonly submissionService: SubmissionService) {} + /** + * 특정 Contest의 모든 제출 내역에 대한 요약을 불러옵니다. + * + * Contest Overall page의 'All submission' 탭에서 보여지는 정보를 불러오는 API + * https://github.com/skkuding/codedang/pull/1924 + */ @Query(() => [ContestSubmission]) async getContestSubmissions( @Args('input', { diff --git a/collection/admin/Contest/Get Contest Score Summaries /Succeed.bru b/collection/admin/Contest/Get Contest Score Summaries /Succeed.bru deleted file mode 100644 index 7d0b9082cf..0000000000 --- a/collection/admin/Contest/Get Contest Score Summaries /Succeed.bru +++ /dev/null @@ -1,65 +0,0 @@ -meta { - name: Succeed - type: graphql - seq: 1 -} - -post { - url: {{gqlUrl}} - body: graphql - auth: none -} - -body:graphql { - query GetContestScoreSummaries($contestId: Int!, $take: Int!) { - getContestScoreSummaries( - contestId: $contestId, - take: $take - ) { - submittedProblemCount - totalProblemCount - userContestScore - contestPerfectScore - problemScores { - problemId - score - maxScore - } - username - studentId - realName - } - } -} - -body:graphql:vars { - { - "contestId": 1, - "take": 10 - } -} - -docs { - ## Get Contest Score Summaries of User - 유저의 특정 Contest에 대한 점수 요약 List를 반환합니다. - - - username - - 유저의 이름 - - studentId - - 유저의 학번 - - realName - - 유저의 실명 - - submittedProblemCount - - 제출된 문제의 개수(정답 여부와 관계 없음) - - totalProblemCount - - 전체 문제의 개수 - - userContestScore - - 해당 Contest에서 User가 획득한 총 점수 - - contestPerfectScore - - Contest의 만점 - - problemScores - - 각 문제에서 획득한 점수를 담고 있는 배열 (100점 만점 기준) - - 속성 - - problemId - - score -} diff --git a/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru b/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru index 03cf923b07..0cddcc3a86 100644 --- a/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru +++ b/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru @@ -26,7 +26,7 @@ body:graphql { } } } - + } body:graphql:vars { @@ -39,7 +39,10 @@ body:graphql:vars { docs { ## Get Contest Score Summary of User 유저의 특정 Contest에 대한 점수 요약을 반환합니다. - + + Contest Overall 페이지에서 특정 유저를 선택했을 때 사용 + https://github.com/skkuding/codedang/pull/1894 + - submittedProblemCount - 제출된 문제의 개수(정답 여부와 관계 없음) - totalProblemCount diff --git a/collection/admin/Contest/Get Contest Submission Summaries of User/Succeed.bru b/collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru similarity index 77% rename from collection/admin/Contest/Get Contest Submission Summaries of User/Succeed.bru rename to collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru index a90eeea672..146cc8ecb6 100644 --- a/collection/admin/Contest/Get Contest Submission Summaries of User/Succeed.bru +++ b/collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru @@ -49,3 +49,11 @@ body:graphql:vars { // "problemId": 1 } } + +docs { + ## Get Contest Submission Summaries of Users + + * Contest에 참여한 User와, 점수 요약을 함께 불러옵니다. + * Contest Overall 페이지의 Participants 탭의 정보 + * https://github.com/skkuding/codedang/pull/2029 +} diff --git a/collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru b/collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru index e1e4c46c09..3d4db915fe 100644 --- a/collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru +++ b/collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru @@ -50,6 +50,7 @@ docs { ## Get Contest Submissions - Contest Overall 페이지 중 All Submissions 탭에서 표시할 데이터를 반환합니다. + - https://github.com/skkuding/codedang/pull/1924 #### 필요 인자 |`input`|`take`|`cursor`| From 92645c399cde6086e27d8bd96bc3e8665a0422de Mon Sep 17 00:00:00 2001 From: Kwon Seo Jin <97675977+B0XERCAT@users.noreply.github.com> Date: Sun, 1 Sep 2024 18:11:15 +0900 Subject: [PATCH 3/6] fix(fe): fix admin hint toggle and datepicker bug (#2050) * fix(fe): change admin problem create hint switch field to use textarea * fix(fe): render time form after getting values from form --- apps/frontend/app/admin/contest/[id]/edit/page.tsx | 4 ++-- apps/frontend/app/admin/problem/create/page.tsx | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/frontend/app/admin/contest/[id]/edit/page.tsx b/apps/frontend/app/admin/contest/[id]/edit/page.tsx index ff8809a7ab..d4f6a726c5 100644 --- a/apps/frontend/app/admin/contest/[id]/edit/page.tsx +++ b/apps/frontend/app/admin/contest/[id]/edit/page.tsx @@ -208,10 +208,10 @@ export default function Page({ params }: { params: { id: string } }) {
- + {getValues('startTime') && } - + {getValues('endTime') && }
diff --git a/apps/frontend/app/admin/problem/create/page.tsx b/apps/frontend/app/admin/problem/create/page.tsx index 8a788fd622..7a53facda3 100644 --- a/apps/frontend/app/admin/problem/create/page.tsx +++ b/apps/frontend/app/admin/problem/create/page.tsx @@ -155,7 +155,12 @@ export default function Page() { - + Date: Sun, 1 Sep 2024 23:08:44 +0900 Subject: [PATCH 4/6] fix(be): resolve upload-problem error (#2057) --- apps/backend/apps/admin/src/problem/problem.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/backend/apps/admin/src/problem/problem.service.ts b/apps/backend/apps/admin/src/problem/problem.service.ts index 8d16840a6f..4caf001072 100644 --- a/apps/backend/apps/admin/src/problem/problem.service.ts +++ b/apps/backend/apps/admin/src/problem/problem.service.ts @@ -135,7 +135,7 @@ export class ProblemService { header['OutputFileName'], header['OutputFilePath'] ] - worksheet.eachRow(async function (row, rowNumber) { + worksheet.eachRow(function (row, rowNumber) { for (const colNumber of unsupportedFields) { if (row.getCell(colNumber).text !== '') throw new UnprocessableFileDataException( From 402162a175ef83235373f70fbe2781c80ad173e1 Mon Sep 17 00:00:00 2001 From: Jaehyeon Kim Date: Mon, 2 Sep 2024 12:48:52 +0900 Subject: [PATCH 5/6] fix(be): return cpu-time and memory-usage null when is-judge-visible is false (#2060) --- .../apps/client/src/submission/submission.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/backend/apps/client/src/submission/submission.service.ts b/apps/backend/apps/client/src/submission/submission.service.ts index ef57c901db..b9bff02c3b 100644 --- a/apps/backend/apps/client/src/submission/submission.service.ts +++ b/apps/backend/apps/client/src/submission/submission.service.ts @@ -487,7 +487,11 @@ export class SubmissionService { results.sort((a, b) => a.problemTestcaseId - b.problemTestcaseId) if (contestId && !isJudgeResultVisible) { - results.map((r) => (r.result = 'Blind')) + results.map((r) => { + r.result = 'Blind' + r.cpuTime = null + r.memoryUsage = null + }) } return { From d8a07d6e24033c5db479bbe2c15bc964a623be5b Mon Sep 17 00:00:00 2001 From: Jaehyeon Kim Date: Mon, 2 Sep 2024 14:59:12 +0900 Subject: [PATCH 6/6] docs(be): change contest overall docs (#2056) docs(be): add bruno docs --- .../Get Contest Score Summaries/Succeed.bru | 47 +++++++++++++++ .../Succeed.bru | 40 +++++++++---- .../Succeed.bru | 59 ------------------- .../Succeed.bru | 0 4 files changed, 74 insertions(+), 72 deletions(-) create mode 100644 collection/admin/Contest/Get Contest Score Summaries/Succeed.bru delete mode 100644 collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru rename collection/admin/Submission/{Get Contest Submission Summaries => Get Contest Submissions}/Succeed.bru (100%) diff --git a/collection/admin/Contest/Get Contest Score Summaries/Succeed.bru b/collection/admin/Contest/Get Contest Score Summaries/Succeed.bru new file mode 100644 index 0000000000..e515c04222 --- /dev/null +++ b/collection/admin/Contest/Get Contest Score Summaries/Succeed.bru @@ -0,0 +1,47 @@ +meta { + name: Succeed + type: graphql + seq: 1 +} + +post { + url: {{gqlUrl}} + body: graphql + auth: none +} + +body:graphql { + query GetContestScoreSummaries($contestId: Int!, $take: Int, $cursor: Int) { + getContestScoreSummaries(contestId:$contestId, take: $take, cursor: $cursor) { + userId + username + studentId + realName + submittedProblemCount + totalProblemCount + userContestScore + contestPerfectScore + problemScores { + problemId + score + maxScore + } + } + } +} + +body:graphql:vars { + { + "contestId": 1, + "userId": 4 + // "problemId": 1 + } +} + +docs { + ## Get Contest Submission Summaries of Users + + * Contest에 참여한 User와, 점수 요약을 함께 불러옵니다. + * Contest Overall 페이지의 Participants 탭의 정보 + * https://github.com/skkuding/codedang/pull/2029 +} diff --git a/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru b/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru index 0cddcc3a86..3c198aed34 100644 --- a/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru +++ b/collection/admin/Contest/Get Contest Score Summary of User/Succeed.bru @@ -11,18 +11,31 @@ post { } body:graphql { - query GetContestScoreSummary($userId: Int!, $contestId: Int!) { - getContestScoreSummary( - userId: $userId, - contestId:$contestId - ) { - submittedProblemCount - totalProblemCount - userContestScore - contestPerfectScore - problemScores { + query getContestSubmissionSummariesByUserId($contestId: Int!, $userId: Int!) { + getContestSubmissionSummaryByUserId(contestId: $contestId, userId: $userId) { + scoreSummary { + contestPerfectScore + problemScores { + problemId + score + } + submittedProblemCount + totalProblemCount + userContestScore + } + submissions { + contestId + problemTitle + studentId + username + submissionResult + language + submissionTime + codeSize problemId - score + ip + order + id } } } @@ -31,8 +44,9 @@ body:graphql { body:graphql:vars { { - "userId": 4, - "contestId": 1 + "contestId": 1, + "userId": 4 + // "problemId": 1 } } diff --git a/collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru b/collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru deleted file mode 100644 index 146cc8ecb6..0000000000 --- a/collection/admin/Contest/Get Contest Submission Summaries of Users/Succeed.bru +++ /dev/null @@ -1,59 +0,0 @@ -meta { - name: Succeed - type: graphql - seq: 1 -} - -post { - url: {{gqlUrl}} - body: graphql - auth: none -} - -body:graphql { - query getContestSubmissionSummariesByUserId($contestId: Int!, $userId: Int!) { - getContestSubmissionSummaryByUserId(contestId: $contestId, userId: $userId) { - scoreSummary { - contestPerfectScore - problemScores { - problemId - score - } - submittedProblemCount - totalProblemCount - userContestScore - } - submissions { - contestId - problemTitle - studentId - username - submissionResult - language - submissionTime - codeSize - problemId - ip - order - id - } - } - } - -} - -body:graphql:vars { - { - "contestId": 1, - "userId": 4 - // "problemId": 1 - } -} - -docs { - ## Get Contest Submission Summaries of Users - - * Contest에 참여한 User와, 점수 요약을 함께 불러옵니다. - * Contest Overall 페이지의 Participants 탭의 정보 - * https://github.com/skkuding/codedang/pull/2029 -} diff --git a/collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru b/collection/admin/Submission/Get Contest Submissions/Succeed.bru similarity index 100% rename from collection/admin/Submission/Get Contest Submission Summaries/Succeed.bru rename to collection/admin/Submission/Get Contest Submissions/Succeed.bru