core: ContestUser: fix endAt calculation

pull/563/head
undefined 1 year ago
parent c26fab42cf
commit 5214a021a9
No known key found for this signature in database

@ -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 };

Loading…
Cancel
Save