core: support ContestRule.hidden

This commit is contained in:
undefined committed 2022-07-09 11:40:33 +08:00
1 parent 7d3f715c6c
commit 86d77625f6
4 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.14.5",
"version": "3.14.6",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+6 -2
View File
@@ -237,7 +237,11 @@ export class ContestEditHandler extends Handler {
async get(domainId: string, tid: ObjectID) {
this.response.template = 'contest_edit.html';
const rules = {};
for (const i in contest.RULES) rules[i] = contest.RULES[i].TEXT;
for (const i in contest.RULES) {
if (!contest.RULES[i].hidden) {
rules[i] = contest.RULES[i].TEXT;
}
}
let ts = Date.now();
ts = ts - (ts % (15 * Time.minute)) + 15 * Time.minute;
this.response.body = {
@@ -256,7 +260,7 @@ export class ContestEditHandler extends Handler {
@param('duration', Types.Float)
@param('title', Types.Title)
@param('content', Types.Content)
@param('rule', Types.Range(Object.keys(contest.RULES).filter((i) => i !== 'homework')))
@param('rule', Types.Range(Object.keys(contest.RULES).filter((i) => !contest.RULES[i].hidden)))
@param('pids', Types.Content)
@param('rated', Types.Boolean)
@param('code', Types.String, true)
+1
View File
@@ -481,6 +481,7 @@ export interface ContestStat extends Record<string, any> {
export interface ContestRule<T = any> {
_originalRule?: Partial<ContestRule<T>>;
TEXT: string;
hidden?: boolean;
check: (args: any) => any;
statusSort: any;
submitAfterAccept: boolean;
+1
View File
@@ -302,6 +302,7 @@ const ioi = buildContestRule({
const homework = buildContestRule({
TEXT: 'Assignment',
hidden: true,
check: () => { },
submitAfterAccept: false,
statusSort: { penaltyScore: -1, time: 1 },