mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: always pick tsdoc endAt field (#1156)
This commit is contained in:
1 parent
cc74b995ee
commit
e3fa08f56c
2 files changed
+3
-3
No files matched your search
@@ -195,7 +195,8 @@ export class ContestDetailHandler extends ContestDetailBaseHandler {
|
||||
if (this.tdoc.rule === 'homework') throw new ContestNotFoundError(domainId, tid);
|
||||
if (!this.tsdoc?.attend) throw new ContestNotAttendedError(domainId, tid);
|
||||
if (!contest.isOngoing(this.tdoc, this.tsdoc)) throw new ContestNotLiveError(domainId, tid);
|
||||
await contest.setStatus(domainId, tid, this.user._id, { endAt: new Date() });
|
||||
const now = new Date();
|
||||
await contest.setStatus(domainId, tid, this.user._id, { endAt: now, ...(!this.tsdoc.startAt ? { startAt: now } : {}) });
|
||||
this.back();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,8 +366,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler {
|
||||
: problem.canViewBy(this.pdoc, this.user) ? 'correction' : 'none',
|
||||
};
|
||||
if (this.tdoc && this.tsdoc) {
|
||||
const fields = ['attend', 'startAt'];
|
||||
if (this.tdoc.duration) fields.push('endAt');
|
||||
const fields = ['attend', 'startAt', 'endAt'];
|
||||
if (contest.canShowSelfRecord.call(this, this.tdoc, true)) fields.push('detail');
|
||||
this.tsdoc = pick(this.tsdoc, fields);
|
||||
this.response.body.tsdoc = this.tsdoc;
|
||||
|
||||
Reference in new issue
Block a user