cleanup debug stuff
This commit is contained in:
parent
86bf939a1a
commit
bddc17fd0d
|
@ -99,23 +99,17 @@ 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";
|
||||||
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;
|
|
||||||
console.log({ chapterTestIds, userCompletedIds })
|
|
||||||
const completed = chapterTestIds
|
|
||||||
.filter(x => userCompletedIds.includes(x))
|
|
||||||
.length;
|
|
||||||
|
|
||||||
return Math.round(
|
const required = chapterTestIds.length;
|
||||||
(completed / (required + 1)) * 100
|
const completed = chapterTestIds
|
||||||
);
|
.filter(x => userCompletedIds.includes(x))
|
||||||
} catch (e) {
|
.length;
|
||||||
console.error("error getting per");
|
|
||||||
console.error(e);
|
return Math.round(
|
||||||
return 0;
|
(completed / (required + 1)) * 100
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GamesBrowser;
|
export default GamesBrowser;
|
Loading…
Reference in New Issue