eslint: add github/array-foreach rule

This commit is contained in:
undefined committed 2023-10-20 20:59:48 +08:00
1 parent 9901ffa62d
commit 335a272db4
21 files changed
+59 -51

No files matched your search

+3 -3
View File
@@ -637,9 +637,9 @@ export class ContestUserHandler extends ContestManagementBaseHandler {
const tsdocs = await contest.getMultiStatus(domainId, { docId: tid }).project({
uid: 1, attend: 1, startAt: 1, unrank: 1,
}).toArray();
tsdocs.forEach((i) => {
i.endAt = (this.tdoc.duration && i.startAt) ? moment(i.startAt).add(this.tdoc.duration, 'hours').toDate() : null;
});
for (const tsdoc of tsdocs) {
tsdoc.endAt = (this.tdoc.duration && tsdoc.startAt) ? moment(tsdoc.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 };
this.response.pjax = 'partials/contest_user.html';
+1 -1
View File
@@ -36,7 +36,7 @@ export class HomeHandler extends Handler {
uids = new Set<number>();
collectUser(uids: number[]) {
uids.forEach((uid) => this.uids.add(uid));
for (const uid of uids) this.uids.add(uid);
}
async getHomework(domainId: string, limit = 5) {