Skip to content

Commit

Permalink
πŸš€ Deploy #89
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaem03 authored Nov 15, 2024
2 parents 4903e39 + ac1d1a0 commit 96908af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/testQuestion/TestQuestion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const TestQuestion = ({
handleAnswerSelect(index);
}
};
console.log("isAnswerinCorrect:", isAnswerinCorrect);

return (
<S.Container>
<S.TestQuestionWrapper>
Expand All @@ -28,7 +30,9 @@ export const TestQuestion = ({
key={index}
onClick={() => handleSelect(index)}
$isSelected={selectedAnswer[currentQuestion] === index}
$isAnswerinCorrect={isAnswerinCorrect} // μ •λ‹΅ μ—¬λΆ€ 처리
$isAnswerinCorrect={
isAnswerinCorrect && selectedAnswer[currentQuestion] === index
}
>
{answer}
</S.AnswerBox>
Expand Down
6 changes: 4 additions & 2 deletions src/pages/nuguTest/ChallengerTest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Cookies from "js-cookie";

export const ChallengerTest = () => {
const { uuid } = useParams();
const [rank, setRank] = useState(null);
const [rank, setRank] = useState([]);
const {
challengerId,
result,
Expand Down Expand Up @@ -54,9 +54,11 @@ export const ChallengerTest = () => {
//μ •λ‹΅ 비ꡐ
const isAnswerinCorrect =
selectedAnswer[currentQuestion] !== null &&
Array.isArray(rank) &&
rank[currentQuestion] !== undefined
? rank[currentQuestion] === selectedAnswer[currentQuestion]
: null;
: false;

const isAnswerSelected = selectedAnswer[currentQuestion] !== null;
return (
<>
Expand Down

0 comments on commit 96908af

Please sign in to comment.