|
|
@ -80,7 +80,7 @@ class HomeworkDetailHandler extends Handler {
|
|
|
|
&& !this.user.own(tdoc)
|
|
|
|
&& !this.user.own(tdoc)
|
|
|
|
&& !this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD)
|
|
|
|
&& !this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD)
|
|
|
|
) return;
|
|
|
|
) return;
|
|
|
|
const pdict = await problem.getList(domainId, tdoc.pids, true, undefined, undefined, problem.PROJECTION_CONTEST_LIST);
|
|
|
|
const pdict = await problem.getList(domainId, tdoc.pids, true, true, problem.PROJECTION_CONTEST_LIST);
|
|
|
|
const psdict = {};
|
|
|
|
const psdict = {};
|
|
|
|
let rdict = {};
|
|
|
|
let rdict = {};
|
|
|
|
if (tsdoc) {
|
|
|
|
if (tsdoc) {
|
|
|
@ -182,7 +182,7 @@ class HomeworkEditHandler extends Handler {
|
|
|
|
const endAt = penaltySince.clone().add(extensionDays, 'days');
|
|
|
|
const endAt = penaltySince.clone().add(extensionDays, 'days');
|
|
|
|
if (beginAt.isSameOrAfter(penaltySince)) throw new ValidationError('endAtDate', 'endAtTime');
|
|
|
|
if (beginAt.isSameOrAfter(penaltySince)) throw new ValidationError('endAtDate', 'endAtTime');
|
|
|
|
if (penaltySince.isAfter(endAt)) throw new ValidationError('extensionDays');
|
|
|
|
if (penaltySince.isAfter(endAt)) throw new ValidationError('extensionDays');
|
|
|
|
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, true);
|
|
|
|
if (!tid) {
|
|
|
|
if (!tid) {
|
|
|
|
tid = await contest.add(domainId, title, content, this.user._id,
|
|
|
|
tid = await contest.add(domainId, title, content, this.user._id,
|
|
|
|
'homework', beginAt.toDate(), endAt.toDate(), pids, rated,
|
|
|
|
'homework', beginAt.toDate(), endAt.toDate(), pids, rated,
|
|
|
|