This commit is contained in:
adueck 2023-01-18 23:49:32 +05:00
parent 1506c60afd
commit c19b126c07
2 changed files with 2 additions and 6 deletions

View File

@ -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 <div>
<div className="d-flex flex-row justify-content-between align-items-center">
<div>

View File

@ -49,7 +49,7 @@ function ChapterDisplay({ chapter, user, handleClick, expanded }: {
</div>
<SmoothCollapse expanded={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 <div key={id}>
<div className="d-flex flex-row justify-content-between align-items-center">