Skip to content

Commit

Permalink
Merge branch 'main' into t787-forbid-score-update-when-submit-exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeon1020 authored Sep 2, 2024
2 parents 397af5d + d8a07d6 commit 6760cdd
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 165 deletions.
33 changes: 13 additions & 20 deletions apps/backend/apps/admin/src/contest/contest.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -239,6 +236,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,
Expand Down Expand Up @@ -293,22 +296,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,
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/apps/admin/src/problem/problem.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions apps/backend/apps/admin/src/submission/submission.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/app/admin/contest/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ export default function Page({ params }: { params: { id: string } }) {
</FormSection>
<div className="flex gap-6">
<FormSection title="Start Time">
<TimeForm name="startTime" />
{getValues('startTime') && <TimeForm name="startTime" />}
</FormSection>
<FormSection title="End Time">
<TimeForm name="endTime" />
{getValues('endTime') && <TimeForm name="endTime" />}
</FormSection>
</div>
<FormSection title="Description">
Expand Down
7 changes: 6 additions & 1 deletion apps/frontend/app/admin/problem/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ export default function Page() {

<TemplateField />

<SwitchField name="hint" title="Hint" placeholder="Enter a hint" />
<SwitchField
name="hint"
title="Hint"
formElement="textarea"
placeholder="Enter a hint"
/>

<SwitchField
name="source"
Expand Down
5 changes: 3 additions & 2 deletions apps/infra/production/codedang/codedang_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 3 additions & 2 deletions apps/infra/production/codedang/codedang_iris.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions apps/infra/production/codedang/codedang_service_client.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
65 changes: 0 additions & 65 deletions collection/admin/Contest/Get Contest Score Summaries /Succeed.bru

This file was deleted.

47 changes: 47 additions & 0 deletions collection/admin/Contest/Get Contest Score Summaries/Succeed.bru
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,52 @@ 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
}
}
}

}

body:graphql:vars {
{
"userId": 4,
"contestId": 1
"contestId": 1,
"userId": 4
// "problemId": 1
}
}

docs {
## Get Contest Score Summary of User
유저의 특정 Contest에 대한 점수 요약을 반환합니다.


Contest Overall 페이지에서 특정 유저를 선택했을 때 사용
https://github.com/skkuding/codedang/pull/1894

- submittedProblemCount
- 제출된 문제의 개수(정답 여부와 관계 없음)
- totalProblemCount
Expand Down
Loading

0 comments on commit 6760cdd

Please sign in to comment.