mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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",
|
"name": "hydrooj",
|
||||||
"version": "3.14.5",
|
"version": "3.14.6",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -237,7 +237,11 @@ export class ContestEditHandler extends Handler {
|
|||||||
async get(domainId: string, tid: ObjectID) {
|
async get(domainId: string, tid: ObjectID) {
|
||||||
this.response.template = 'contest_edit.html';
|
this.response.template = 'contest_edit.html';
|
||||||
const rules = {};
|
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();
|
let ts = Date.now();
|
||||||
ts = ts - (ts % (15 * Time.minute)) + 15 * Time.minute;
|
ts = ts - (ts % (15 * Time.minute)) + 15 * Time.minute;
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
@@ -256,7 +260,7 @@ export class ContestEditHandler extends Handler {
|
|||||||
@param('duration', Types.Float)
|
@param('duration', Types.Float)
|
||||||
@param('title', Types.Title)
|
@param('title', Types.Title)
|
||||||
@param('content', Types.Content)
|
@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('pids', Types.Content)
|
||||||
@param('rated', Types.Boolean)
|
@param('rated', Types.Boolean)
|
||||||
@param('code', Types.String, true)
|
@param('code', Types.String, true)
|
||||||
|
|||||||
@@ -481,6 +481,7 @@ export interface ContestStat extends Record<string, any> {
|
|||||||
export interface ContestRule<T = any> {
|
export interface ContestRule<T = any> {
|
||||||
_originalRule?: Partial<ContestRule<T>>;
|
_originalRule?: Partial<ContestRule<T>>;
|
||||||
TEXT: string;
|
TEXT: string;
|
||||||
|
hidden?: boolean;
|
||||||
check: (args: any) => any;
|
check: (args: any) => any;
|
||||||
statusSort: any;
|
statusSort: any;
|
||||||
submitAfterAccept: boolean;
|
submitAfterAccept: boolean;
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ const ioi = buildContestRule({
|
|||||||
|
|
||||||
const homework = buildContestRule({
|
const homework = buildContestRule({
|
||||||
TEXT: 'Assignment',
|
TEXT: 'Assignment',
|
||||||
|
hidden: true,
|
||||||
check: () => { },
|
check: () => { },
|
||||||
submitAfterAccept: false,
|
submitAfterAccept: false,
|
||||||
statusSort: { penaltyScore: -1, time: 1 },
|
statusSort: { penaltyScore: -1, time: 1 },
|
||||||
|
|||||||
Reference in new issue
Block a user