core: fix bugs (#702)

This commit is contained in:
panda authored and GitHub committed 2023-12-14 17:06:28 +08:00
1 parent 55b4e1aaf0
commit 453d9076b0
10 files changed
+18 -23

No files matched your search

+1
View File
@@ -473,6 +473,7 @@ export class ContestEditHandler extends Handler {
if (beginAtMoment.isSameOrAfter(endAt)) throw new ValidationError('duration');
const beginAt = beginAtMoment.toDate();
const lockAt = lock ? moment(endAt).add(-lock, 'minutes').toDate() : null;
if (lockAt && contestDuration) throw new ValidationError('lockAt', 'duration');
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, true);
if (tid) {
await contest.edit(domainId, tid, {
+1
View File
@@ -254,6 +254,7 @@ class SystemUserImportHandler extends SystemHandler {
groups[data.group].push(email);
}
if (data.school) payload.school = data.school;
if (data.studentId) payload.studentId = data.studentId;
} catch (e) { }
udocs.push({
email, username, password, displayName, payload,
+6 -13
View File
@@ -489,19 +489,12 @@ export class ProblemSubmitHandler extends ProblemDetailHandler {
const langRange = (typeof this.pdoc.config === 'object' && this.pdoc.config.langs)
? Object.fromEntries(this.pdoc.config.langs.map((i) => [i, setting.langs[i]?.display || i]))
: setting.SETTINGS_BY_KEY.codeLang.range;
this.response.body = {
langRange,
pdoc: this.pdoc,
udoc: this.udoc,
tdoc: this.tdoc,
tsdoc: this.tsdoc,
title: this.pdoc.title,
page_name: this.tdoc
? this.tdoc.rule === 'homework'
? 'homework_detail_problem_submit'
: 'contest_detail_problem_submit'
: 'problem_submit',
};
this.response.body.langRange = langRange;
this.response.body.page_name = this.tdoc
? this.tdoc.rule === 'homework'
? 'homework_detail_problem_submit'
: 'contest_detail_problem_submit'
: 'problem_submit';
}
@param('lang', Types.Name)