Skip to content

Commit

Permalink
Fix points calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
aweell committed Nov 26, 2024
1 parent 5953ab6 commit 2d83c33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const HigherLowerdataSet2 = [
{ label: "Teams using the design system", value: 108 },
];

const HigherOrLower = ({ data, onFinish }) => {
const HigherOrLower = ({ set, data, onFinish }) => {
const [index, setIndex] = useState(0);
const [score, setScore] = useState(0);
const [message, setMessage] = useState("");
Expand All @@ -54,7 +54,7 @@ const HigherOrLower = ({ data, onFinish }) => {

useEffect(() => {
const savedGames = JSON.parse(localStorage.getItem("gameScores")) || {};
const savedGame = savedGames["higherOrLower"];
const savedGame = savedGames[`higherOrLower${set}`];

if (savedGame?.completed) {
setScore(savedGame.score);
Expand Down Expand Up @@ -98,7 +98,7 @@ const HigherOrLower = ({ data, onFinish }) => {
setIsCorrect(null);
} else {
setStatus("final");
saveGameData("Higher or lower", score, true);
saveGameData(`higherOrLower${set}`, score, true);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/pages/advent-calendar-2024/utils/content-config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const contentByDate = {
illustration: <Illustration11 />,
illustrationDimmed: <Illustration11 disabled />,
content: ({ closeModal }) => (
<HigherOrLower data={HigherLowerdataSet1} onFinish={closeModal} />
<HigherOrLower set={1} data={HigherLowerdataSet1} onFinish={closeModal} />
),
title: "Higher or Lower",
description:
Expand Down Expand Up @@ -237,7 +237,7 @@ const contentByDate = {
illustration: <Illustration17 />,
illustrationDimmed: <Illustration17 disabled />,
content: ({ closeModal }) => (
<HigherOrLower data={HigherLowerdataSet2} onFinish={closeModal} />
<HigherOrLower set={2} data={HigherLowerdataSet2} onFinish={closeModal} />
),
title: "Higher or Lower",
description:
Expand Down

0 comments on commit 2d83c33

Please sign in to comment.