core: contest: support realtime scoreboard after freeze contest (#544)

Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
undefinedandpanda authored and GitHub committed 2023-03-22 23:22:49 +08:00
1 parent e233bbb4cf
commit 17cf1194de
7 files changed
+96 -82

No files matched your search

+3 -2
View File
@@ -7,7 +7,7 @@ import { Filter, ObjectId } from 'mongodb';
import { nanoid } from 'nanoid';
import { sortFiles, streamToBuffer } from '@hydrooj/utils/lib/utils';
import {
ContestNotAttendedError, ContestNotEndedError, ContestNotFoundError, ContestNotLiveError,
BadRequestError, ContestNotAttendedError, ContestNotEndedError, ContestNotFoundError, ContestNotLiveError,
FileLimitExceededError, HackFailedError, NoProblemError, NotFoundError,
PermissionError, ProblemAlreadyExistError, ProblemAlreadyUsedByContestError, ProblemConfigError,
ProblemIsReferencedError, ProblemNotAllowLanguageError, ProblemNotAllowPretestError, ProblemNotFoundError,
@@ -449,6 +449,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
@param('target', Types.String)
async postCopy(domainId: string, target: string) {
if (this.pdoc.reference) throw new BadRequestError('Cannot copy a referenced problem');
const t = `,${this.domain.share || ''},`;
if (t !== ',*,' && !t.includes(`,${target},`)) throw new PermissionError(target);
const ddoc = await domain.get(target);
@@ -1011,7 +1012,7 @@ export class ProblemPrefixListHandler extends Handler {
export async function apply(ctx) {
ctx.Route('problem_main', '/p', ProblemMainHandler, PERM.PERM_VIEW_PROBLEM);
ctx.Route('problem_random', '/problem/random', ProblemRandomHandler, PERM.PERM_VIEW_PROBLEM);
ctx.Route('problem_detail', '/p/:pid', ProblemDetailHandler, PERM.PERM_VIEW_PROBLEM);
ctx.Route('problem_detail', '/p/:pid', ProblemDetailHandler);
ctx.Route('problem_submit', '/p/:pid/submit', ProblemSubmitHandler, PERM.PERM_SUBMIT_PROBLEM);
ctx.Route('problem_hack', '/p/:pid/hack/:rid', ProblemHackHandler, PERM.PERM_SUBMIT_PROBLEM);
ctx.Route('problem_edit', '/p/:pid/edit', ProblemEditHandler);