Skip to content

Commit

Permalink
fix: save correct answers in draft quizzes
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Mar 12, 2024
1 parent a81e46c commit 7da5871
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export function CreateQuestions() {
const updatedQuestions = [...questions.slice(0, index), questionParams, ...questions.slice(index + 1)];
setQuestions(updatedQuestions);
const validQuestions = updatedQuestions.filter(question => isValidQuestion(question));

await actions.interactivityCenter.addQuestionsToPoll(id, validQuestions);
}}
isQuiz={isQuiz}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SavedQuestion = ({
length: number;
convertToDraft: (draftID: number) => void;
}) => {
const answerArray = [question?.answer?.option, ...(question.answer?.options || [])];
return (
<>
<Text variant="overline" css={{ c: '$on_surface_low', textTransform: 'uppercase' }}>
Expand All @@ -29,8 +30,9 @@ export const SavedQuestion = ({
<Text variant="body2" css={{ c: '$on_surface_medium' }}>
{option.text}
</Text>
{/* Fix needed here */}
{/* @ts-ignore */}
{option.isCorrectAnswer && (
{(answerArray.includes(index + 1) || option.isCorrectAnswer) && (
<Flex css={{ color: '$alert_success', mx: '$xs' }}>
<CheckCircleIcon height={24} width={24} />
</Flex>
Expand Down

0 comments on commit 7da5871

Please sign in to comment.