From e0508c8883ef40ddfbd2b84823ca56d203be86a0 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:51:10 +0400 Subject: [PATCH] better --- account/src/routers/auth-router.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account/src/routers/auth-router.ts b/account/src/routers/auth-router.ts index 1afe0a5..5685b17 100644 --- a/account/src/routers/auth-router.ts +++ b/account/src/routers/auth-router.ts @@ -306,7 +306,7 @@ const authRouter = (passport: PassportStatic) => { function getTestCompletionSummary(users: T.LingdocsUser[]) { const tests: { id: string, passes: number }[] = []; users.forEach(u => ( - u.tests.forEach(({id}) => { + Array.from(new Set(u.tests.map(x => x.id))).forEach(id => { const ti = tests.findIndex(x => x.id === id); if (ti > -1) tests[ti].passes++; else tests.push({ id, passes: 1 });