more test info
This commit is contained in:
parent
4fda7475f4
commit
4d654d0060
|
@ -154,11 +154,15 @@ const authRouter = (passport: PassportStatic) => {
|
|||
const users = (await getAllLingdocsUsers()).sort((a, b) => (
|
||||
(a.accountCreated || 0) - (b.accountCreated || 0)
|
||||
));
|
||||
const tests = new Set<string>();
|
||||
users.forEach(u => u.tests.forEach(t => (
|
||||
tests.add(t.id)
|
||||
)));
|
||||
res.render("admin", { users, tests: Array.from(tests) });
|
||||
const tests: { id: string, passes: number }[] = [];
|
||||
users.forEach(u => (
|
||||
u.tests.forEach(({id}) => {
|
||||
const ti = tests.findIndex(x => x.id === id);
|
||||
if (ti > -1) tests[ti].passes++;
|
||||
else tests.push({ id, passes: 0 });
|
||||
})
|
||||
));
|
||||
res.render("admin", { users, tests });
|
||||
} catch (e) {
|
||||
next(e);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<div>
|
||||
<h5>Tests Completed</h5>
|
||||
<% for(var i=0; i < tests.length; i++) { %>
|
||||
<div><%= tests[i] %></div>
|
||||
<div><%= tests[i].id %>: <%= tests[i].passes =></div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue