debug
This commit is contained in:
parent
a3219230bc
commit
21072755c1
|
@ -103,16 +103,23 @@ 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";
|
||||||
const chapterTestIds = chapter.items.map(gr => gr.id);
|
console.log({ tests, chapter });
|
||||||
const userCompletedIds = tests.map(t => t.id);
|
try {
|
||||||
const required = chapterTestIds.length;
|
const chapterTestIds = chapter.items.map(gr => gr.id);
|
||||||
const completed = chapterTestIds
|
const userCompletedIds = tests.map(t => t.id);
|
||||||
.filter(userCompletedIds.includes)
|
const required = chapterTestIds.length;
|
||||||
.length;
|
const completed = chapterTestIds
|
||||||
|
.filter(userCompletedIds.includes)
|
||||||
return Math.round(
|
.length;
|
||||||
(completed / (required + 1)) * 100
|
|
||||||
);
|
return Math.round(
|
||||||
|
(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