Skip to content

Commit

Permalink
feat: add ranklistSkipCalculation
Browse files Browse the repository at this point in the history
  • Loading branch information
thezzisu committed Aug 10, 2024
1 parent 175b643 commit 1188d65
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const keys: {
solutionShowOtherDetails: 'solution-show-other-details',
solutionShowOtherData: 'solution-show-other-data',
ranklistEnabled: 'ranklist-enabled',
ranklistSkipCalculation: 'ranklist-skip-calculation',
participantEnabled: 'participant-enabled'
}
Expand All @@ -62,6 +63,7 @@ en:
solution-show-other-details: Solution Allow Other Details
solution-show-other-data: Solution Allow Other Data
ranklist-enabled: Ranklist Enabled
ranklist-skip-calculation: Skip Ranklist Calculation
participant-enabled: Participant Enabled
contest-stage-settings-hint:
registration-enabled: Enable registration
Expand All @@ -75,6 +77,7 @@ en:
solution-show-other-details: Allow show other details
solution-show-other-data: Allow show other data
ranklist-enabled: Enable ranklist
ranklist-skip-calculation: Skip ranklist calculation
participant-enabled: Enable participant
zh-Hans:
contest-stage-settings:
Expand All @@ -89,6 +92,7 @@ zh-Hans:
solution-show-other-details: 允许展示他人提交记录细节
solution-show-other-data: 允许展示他人提交记录数据
ranklist-enabled: 启用排名
ranklist-skip-calculation: 跳过排名计算
participant-enabled: 启用参赛者
contest-stage-settings-hint:
registration-enabled: 开启后,选手才可以报名
Expand All @@ -102,5 +106,6 @@ zh-Hans:
solution-show-other-details: 开启后,选手可以查看他人提交详情
solution-show-other-data: 开启后,选手可以查看他人提交内容(代码、数据等)
ranklist-enabled: 开启后,选手才可以查看排行榜
ranklist-skip-calculation: 开启后,本阶段提交不计入排行榜(订正模式)
participant-enabled: 开启后,选手才可以查看参赛者列表
</i18n>
28 changes: 27 additions & 1 deletion apps/server/src/routes/runner/ranklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
contestRanklistKey,
getUploadUrl
} from '../../index.js'
import { T } from '../../schemas/index.js'
import { SContestStage, T } from '../../schemas/index.js'
import { defineInjectionPoint } from '../../utils/inject.js'
import { defineRoutes, loadUUID, paramSchemaMerger } from '../common/index.js'

Expand Down Expand Up @@ -74,6 +74,32 @@ const runnerRanklistTaskRoutes = defineRoutes(async (s) => {
}
)

s.get(
'/contest',
{
schema: {
description: 'Get contest details',
response: {
200: T.Object({
_id: T.UUID(),
slug: T.String(),
title: T.String(),
description: T.String(),
tags: T.Array(T.String()),
stages: T.Array(SContestStage)
})
}
}
},
async (req, rep) => {
const ctx = req.inject(kRunnerRanklistContext)

const contest = await contests.findOne({ _id: ctx._contestId, ranklistTaskId: ctx._taskId })
if (!contest) return rep.notFound()
return contest
}
)

s.get(
'/problems',
{
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/schemas/contest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const SContestStage = T.StrictObject({
solutionShowOtherData: T.Boolean(),
// Enable function function to participants
ranklistEnabled: T.Boolean(),
// Skip ranklist calculation
ranklistSkipCalculation: T.Boolean(),
// Show participants panel
participantEnabled: T.Boolean(),
// Participant tag rules
Expand Down

0 comments on commit 1188d65

Please sign in to comment.