core: ContestUser: fix endAt calculation

This commit is contained in:
undefined committed 2023-04-22 18:10:36 +08:00
1 parent c26fab42cf
commit 5214a021a9
1 file changed
+1 -1
+1 -1
View File
@@ -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 };