- {userSolutions &&
+ {correctUserSolutions &&
text.split("\\n").map((line, index) => (
{renderLines(line)}
@@ -189,14 +198,14 @@ export default function FillBlanksSolutions({
diff --git a/src/components/Solutions/MultipleChoice.tsx b/src/components/Solutions/MultipleChoice.tsx
index 095e3a5e..320163e4 100644
--- a/src/components/Solutions/MultipleChoice.tsx
+++ b/src/components/Solutions/MultipleChoice.tsx
@@ -17,8 +17,7 @@ function Question({
}: MultipleChoiceQuestion & { userSolution: string | undefined; onSelectOption?: (option: string) => void; showSolution?: boolean }) {
const { userSolutions } = useExamStore((state) => state);
- /*
- const getShuffledOptions = (options: {id: string, text: string}[], questionShuffleMap: ShuffleMap) => {
+ const getShuffledOptions = (options: { id: string, text: string }[], questionShuffleMap: ShuffleMap) => {
const shuffledOptions = ['A', 'B', 'C', 'D'].map(newId => {
const originalId = questionShuffleMap.map[newId];
const originalOption = options.find(option => option.id === originalId);
@@ -43,10 +42,9 @@ function Question({
if (foundMap) return foundMap;
return userSolution.shuffleMaps?.find(map => map.id === id) || null;
}, null as ShuffleMap | null);
- */
-
- const questionOptions = options; // questionShuffleMap ? getShuffledOptions(options as {id: string, text: string}[], questionShuffleMap) : options;
- const newSolution = solution; //questionShuffleMap ? getShuffledSolution(solution, questionShuffleMap) : solution;
+
+ const questionOptions = questionShuffleMap ? getShuffledOptions(options as { id: string, text: string }[], questionShuffleMap) : options;
+ const newSolution = questionShuffleMap ? getShuffledSolution(solution, questionShuffleMap) : solution;
const renderPrompt = (prompt: string) => {
return reactStringReplace(prompt, /(.*?<\/u>)/g, (match) => {
@@ -68,23 +66,23 @@ function Question({
};
return (
-
+
{isNaN(Number(id)) ? (
{renderPrompt(prompt).filter((x) => x?.toString() !== "")}
) : (
-
+
<>
- {id} - {renderPrompt(prompt).filter((x) => x?.toString() !== "")}
+ {id} - {renderPrompt(prompt).filter((x) => x?.toString() !== "")}
>
)}
-
+
{variant === "image" &&
questionOptions.map((option) => (
{option?.id}
@@ -95,7 +93,7 @@ function Question({
questionOptions.map((option) => (
+ className={clsx("flex border p-4 rounded-xl gap-2 cursor-pointer bg-white text-base select-none", optionColor(option!.id))}>
{option?.id}.
{option?.text}
@@ -106,7 +104,8 @@ function Question({
}
export default function MultipleChoice({ id, type, prompt, questions, userSolutions, onNext, onBack }: MultipleChoiceExercise & CommonProps) {
- const { questionIndex, setQuestionIndex } = useExamStore((state) => state);
+ const { questionIndex, setQuestionIndex, partIndex, exam } = useExamStore((state) => state);
+
const calculateScore = () => {
const total = questions.length;
@@ -138,7 +137,7 @@ export default function MultipleChoice({ id, type, prompt, questions, userSoluti
<>
- {prompt}
+ {/*{prompt}*/}
{userSolutions && questionIndex < questions.length && (
-
+
-