From c19b126c071634678880fa44dc638f69a867a3f6 Mon Sep 17 00:00:00 2001 From: adueck Date: Wed, 18 Jan 2023 23:49:32 +0500 Subject: [PATCH] oops --- src/games/GameDisplay.tsx | 6 +----- src/games/GamesBrowser.tsx | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/games/GameDisplay.tsx b/src/games/GameDisplay.tsx index 00b38cc..5daee9c 100644 --- a/src/games/GameDisplay.tsx +++ b/src/games/GameDisplay.tsx @@ -2,11 +2,7 @@ import { useUser } from "../user-context"; function GameDisplay({ record: { title, Game, id } }: { record: GameRecord }) { const { user } = useUser(); - const completed = user?.tests.some((t) => ( - // TODO: Or if it's in the locally stored (unposted test results) - (t.done === true) && (t.id === id) - )); - console.log({ id, completed, tests: user?.tests }); + const completed = user?.tests.some((t) => t.done && t.id === id); return
diff --git a/src/games/GamesBrowser.tsx b/src/games/GamesBrowser.tsx index 915d19c..24e5bcf 100644 --- a/src/games/GamesBrowser.tsx +++ b/src/games/GamesBrowser.tsx @@ -49,7 +49,7 @@ function ChapterDisplay({ chapter, user, handleClick, expanded }: {
{chapter.items.map(({ id, title, Game }) => { - const done = user && user.tests.some(t => t.id === id); + const done = user?.tests.some(t => t.done && t.id === id); const open = opened === id; return