debug
This commit is contained in:
parent
a3219230bc
commit
21072755c1
|
@ -103,6 +103,8 @@ function getPercentageComplete(
|
||||||
tests: undefined | AT.TestResult[],
|
tests: undefined | AT.TestResult[],
|
||||||
): "not logged in" | number {
|
): "not logged in" | number {
|
||||||
if (!tests) return "not logged in";
|
if (!tests) return "not logged in";
|
||||||
|
console.log({ tests, chapter });
|
||||||
|
try {
|
||||||
const chapterTestIds = chapter.items.map(gr => gr.id);
|
const chapterTestIds = chapter.items.map(gr => gr.id);
|
||||||
const userCompletedIds = tests.map(t => t.id);
|
const userCompletedIds = tests.map(t => t.id);
|
||||||
const required = chapterTestIds.length;
|
const required = chapterTestIds.length;
|
||||||
|
@ -113,6 +115,11 @@ function getPercentageComplete(
|
||||||
return Math.round(
|
return Math.round(
|
||||||
(completed / (required + 1)) * 100
|
(completed / (required + 1)) * 100
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("error getting per");
|
||||||
|
console.error(e);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GamesBrowser;
|
export default GamesBrowser;
|
Loading…
Reference in New Issue