diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 99e4a56e..d56f0329 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -613,7 +613,7 @@ export class ContestUserHandler extends ContestManagementBaseHandler { async get(domainId: string, tid: ObjectId) { const tsdocs = await contest.getMultiStatus(domainId, { docId: tid }).toArray(); tsdocs.forEach((i) => { - i.endAt = this.tdoc.duration ? moment(this.tsdoc.startAt).add(this.tdoc.duration, 'hours').toDate() : null; + i.endAt = (this.tdoc.duration && i.startAt) ? moment(i.startAt).add(this.tdoc.duration, 'hours').toDate() : null; }); const udict = await user.getListForRender(domainId, [this.tdoc.owner, ...tsdocs.map((i) => i.uid)]); this.response.body = { tdoc: this.tdoc, tsdocs, udict };