mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: support ContestRule.hidden
This commit is contained in:
1 parent
7d3f715c6c
commit
86d77625f6
4 files changed
+9
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.14.5",
|
||||
"version": "3.14.6",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -302,6 +302,7 @@ const ioi = buildContestRule({
|
||||
|
||||
const homework = buildContestRule({
|
||||
TEXT: 'Assignment',
|
||||
hidden: true,
|
||||
check: () => { },
|
||||
submitAfterAccept: false,
|
||||
statusSort: { penaltyScore: -1, time: 1 },
|
||||
|
||||
Reference in new issue
Block a user