Improved an error we had before
This commit is contained in:
@@ -27,8 +27,6 @@ export interface CommonProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const renderSolution = (exercise: Exercise, onNext: () => void, onBack: () => void) => {
|
export const renderSolution = (exercise: Exercise, onNext: () => void, onBack: () => void) => {
|
||||||
console.log(exercise);
|
|
||||||
|
|
||||||
switch (exercise.type) {
|
switch (exercise.type) {
|
||||||
case "fillBlanks":
|
case "fillBlanks":
|
||||||
return <FillBlanks {...(exercise as FillBlanksExercise)} onNext={onNext} onBack={onBack} />;
|
return <FillBlanks {...(exercise as FillBlanksExercise)} onNext={onNext} onBack={onBack} />;
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ export default function ExamList() {
|
|||||||
header: "",
|
header: "",
|
||||||
id: "actions",
|
id: "actions",
|
||||||
cell: ({row}: {row: {original: Exam}}) => {
|
cell: ({row}: {row: {original: Exam}}) => {
|
||||||
console.log(row.original);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-tip="Load exam"
|
data-tip="Load exam"
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export default function Page() {
|
|||||||
Object.assign(x, !x.userSolutions ? {userSolutions: userSolutions.find((y) => x.id === y.exercise)?.solutions} : x.userSolutions),
|
Object.assign(x, !x.userSolutions ? {userSolutions: userSolutions.find((y) => x.id === y.exercise)?.solutions} : x.userSolutions),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Object.assign(exam, exercises);
|
return Object.assign(exam, {exercises});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (solutions: UserSolution[]) => {
|
const onFinish = (solutions: UserSolution[]) => {
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export default function Page() {
|
|||||||
const updateExamWithUserSolutions = (exam: Exam): Exam => {
|
const updateExamWithUserSolutions = (exam: Exam): Exam => {
|
||||||
const exercises = exam.exercises.map((x) => Object.assign(x, {userSolutions: userSolutions.find((y) => x.id === y.exercise)?.solutions}));
|
const exercises = exam.exercises.map((x) => Object.assign(x, {userSolutions: userSolutions.find((y) => x.id === y.exercise)?.solutions}));
|
||||||
|
|
||||||
return Object.assign(exam, exercises);
|
return Object.assign(exam, {exercises});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFinish = (solutions: UserSolution[]) => {
|
const onFinish = (solutions: UserSolution[]) => {
|
||||||
@@ -291,6 +291,7 @@ export default function Page() {
|
|||||||
abandonPopupDescription="Are you sure you want to leave the exercise? You will lose all your progress."
|
abandonPopupDescription="Are you sure you want to leave the exercise? You will lose all your progress."
|
||||||
abandonConfirmButtonText="Confirm"
|
abandonConfirmButtonText="Confirm"
|
||||||
onAbandon={() => {
|
onAbandon={() => {
|
||||||
|
alert("HERE");
|
||||||
reset();
|
reset();
|
||||||
setShowAbandonPopup(false);
|
setShowAbandonPopup(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user