core: always pick tsdoc endAt field (#1156)

This commit is contained in:
Baoshuo authored and GitHub committed 2026-05-07 23:33:45 +08:00
1 parent cc74b995ee
commit e3fa08f56c
2 files changed
+3 -3

No files matched your search

+2 -1
View File
@@ -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();
}
}