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) => (
|
const users = (await getAllLingdocsUsers()).sort((a, b) => (
|
||||||
(a.accountCreated || 0) - (b.accountCreated || 0)
|
(a.accountCreated || 0) - (b.accountCreated || 0)
|
||||||
));
|
));
|
||||||
const tests = new Set<string>();
|
const tests: { id: string, passes: number }[] = [];
|
||||||
users.forEach(u => u.tests.forEach(t => (
|
users.forEach(u => (
|
||||||
tests.add(t.id)
|
u.tests.forEach(({id}) => {
|
||||||
)));
|
const ti = tests.findIndex(x => x.id === id);
|
||||||
res.render("admin", { users, tests: Array.from(tests) });
|
if (ti > -1) tests[ti].passes++;
|
||||||
|
else tests.push({ id, passes: 0 });
|
||||||
|
})
|
||||||
|
));
|
||||||
|
res.render("admin", { users, tests });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
next(e);
|
next(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
<div>
|
<div>
|
||||||
<h5>Tests Completed</h5>
|
<h5>Tests Completed</h5>
|
||||||
<% for(var i=0; i < tests.length; i++) { %>
|
<% for(var i=0; i < tests.length; i++) { %>
|
||||||
<div><%= tests[i] %></div>
|
<div><%= tests[i].id %>: <%= tests[i].passes =></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue