mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix contestDuration default value
This commit is contained in:
1 parent
c4897b0aba
commit
0b389cbbfd
2 files changed
+2
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.14.11",
|
"version": "3.14.12",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ export class ContestEditHandler extends Handler {
|
|||||||
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
|
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
|
||||||
title: string, content: string, rule: string, _pids: string, rated = false,
|
title: string, content: string, rule: string, _pids: string, rated = false,
|
||||||
_code = '', autoHide = false, assign: string[] = null, lock: number = null,
|
_code = '', autoHide = false, assign: string[] = null, lock: number = null,
|
||||||
contestDuration?: number,
|
contestDuration: number = null,
|
||||||
) {
|
) {
|
||||||
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||||
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
|
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
|
||||||
@@ -288,7 +288,6 @@ export class ContestEditHandler extends Handler {
|
|||||||
if (beginAtMoment.isSameOrAfter(endAt)) throw new ValidationError('duration');
|
if (beginAtMoment.isSameOrAfter(endAt)) throw new ValidationError('duration');
|
||||||
const beginAt = beginAtMoment.toDate();
|
const beginAt = beginAtMoment.toDate();
|
||||||
const lockAt = lock ? moment(endAt).add(-lock, 'minutes').toDate() : null;
|
const lockAt = lock ? moment(endAt).add(-lock, 'minutes').toDate() : null;
|
||||||
contestDuration ||= duration;
|
|
||||||
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, this.user.group, true);
|
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, this.user.group, true);
|
||||||
if (tid) {
|
if (tid) {
|
||||||
await contest.edit(domainId, tid, {
|
await contest.edit(domainId, tid, {
|
||||||
|
|||||||
Reference in new issue
Block a user