mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 17:38:19 +08:00
core&ui: add contest language limit (#1014)
Co-authored-by: panda <panda_dtdyy@outlook.com>
This commit is contained in:
1 parent
0699e17ce6
commit
4165e9b153
23 files changed
+175
-232
No files matched your search
@@ -305,11 +305,12 @@ export class ContestEditHandler extends Handler {
|
||||
@param('contestDuration', Types.Float, true)
|
||||
@param('maintainer', Types.NumericArray, true)
|
||||
@param('allowViewCode', Types.Boolean)
|
||||
@param('langs', Types.CommaSeperatedArray, true)
|
||||
async postUpdate(
|
||||
domainId: string, tid: ObjectId, beginAtDate: string, beginAtTime: string, duration: number,
|
||||
title: string, content: string, rule: string, _pids: string, rated = false,
|
||||
_code = '', autoHide = false, assign: string[] = [], lock: number = null,
|
||||
contestDuration: number = null, maintainer: number[] = [], allowViewCode = false,
|
||||
contestDuration: number = null, maintainer: number[] = [], allowViewCode = false, langs: string[] = [],
|
||||
) {
|
||||
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
|
||||
@@ -350,7 +351,7 @@ export class ContestEditHandler extends Handler {
|
||||
});
|
||||
}
|
||||
await contest.edit(domainId, tid, {
|
||||
assign, _code, autoHide, lockAt, maintainer, allowViewCode,
|
||||
assign, _code, autoHide, lockAt, maintainer, allowViewCode, langs,
|
||||
});
|
||||
this.response.body = { tid };
|
||||
this.response.redirect = this.url('contest_detail', { tid });
|
||||
|
||||
@@ -191,11 +191,12 @@ class HomeworkEditHandler extends Handler {
|
||||
@param('rated', Types.Boolean)
|
||||
@param('maintainer', Types.NumericArray, true)
|
||||
@param('assign', Types.CommaSeperatedArray, true)
|
||||
@param('langs', Types.CommaSeperatedArray, true)
|
||||
async postUpdate(
|
||||
domainId: string, tid: ObjectId, beginAtDate: string, beginAtTime: string,
|
||||
penaltySinceDate: string, penaltySinceTime: string, extensionDays: number,
|
||||
penaltyRules: PenaltyRules, title: string, content: string, _pids: string, rated = false,
|
||||
maintainer: number[] = [], assign: string[] = [],
|
||||
maintainer: number[] = [], assign: string[] = [], langs: string[] = [],
|
||||
) {
|
||||
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
|
||||
const tdoc = tid ? await contest.get(domainId, tid) : null;
|
||||
@@ -226,6 +227,7 @@ class HomeworkEditHandler extends Handler {
|
||||
rated,
|
||||
maintainer,
|
||||
assign,
|
||||
langs,
|
||||
});
|
||||
if (tdoc.beginAt !== beginAt.toDate()
|
||||
|| tdoc.endAt !== endAt.toDate()
|
||||
|
||||
@@ -304,6 +304,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
if (this.pdoc.config.langs) t.push(this.pdoc.config.langs);
|
||||
if (ddoc.langs) t.push(ddoc.langs.split(',').map((i) => i.trim()).filter((i) => i));
|
||||
if (this.domain.langs) t.push(this.domain.langs.split(',').map((i) => i.trim()).filter((i) => i));
|
||||
if (this.tdoc?.langs) t.push(this.tdoc.langs);
|
||||
if (this.pdoc.config.type === 'remote_judge') {
|
||||
const p = this.pdoc.config.subType;
|
||||
const dl = Object.keys(setting.langs).filter((i) => i.startsWith(`${p}.`) || setting.langs[i].validAs[p]);
|
||||
|
||||
Reference in new issue
Block a user