Improved an error we had before

This commit is contained in:
Tiago Ribeiro
2023-09-25 14:57:14 +01:00
parent cb5434d166
commit 8b7e7cf0ad
4 changed files with 3 additions and 5 deletions

View File

@@ -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} />;

View File

@@ -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"

View File

@@ -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[]) => {

View File

@@ -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);
}} }}