Solved a bug where the speaking and interactive speaking were not being correctly evaluated
This commit is contained in:
@@ -81,7 +81,7 @@ export default function Speaking({id, title, text, video_url, type, prompts, use
|
||||
onNext({
|
||||
exercise: id,
|
||||
solutions: storagePath ? [{id, solution: storagePath}] : [],
|
||||
score: {correct: 100, total: 100, missing: 0},
|
||||
score: {correct: 0, total: 100, missing: 0},
|
||||
type,
|
||||
});
|
||||
};
|
||||
@@ -94,7 +94,7 @@ export default function Speaking({id, title, text, video_url, type, prompts, use
|
||||
onBack({
|
||||
exercise: id,
|
||||
solutions: storagePath ? [{id, solution: storagePath}] : [],
|
||||
score: {correct: 100, total: 100, missing: 0},
|
||||
score: {correct: 0, total: 100, missing: 0},
|
||||
type,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -64,6 +64,7 @@ export interface UserSolution {
|
||||
missing: number;
|
||||
};
|
||||
exercise: string;
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
|
||||
export interface WritingExam {
|
||||
|
||||
@@ -123,6 +123,7 @@ export interface Stat {
|
||||
total: number;
|
||||
missing: number;
|
||||
};
|
||||
isDisabled?: boolean;
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
|
||||
@@ -193,6 +193,7 @@ export default function ExamPage({page}: Props) {
|
||||
module: exam!.module,
|
||||
user: user?.id || "",
|
||||
date: new Date().getTime(),
|
||||
isDisabled: solution.isDisabled,
|
||||
...(assignment ? {assignment: assignment.id} : {}),
|
||||
}));
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
missing: 0,
|
||||
total: 100,
|
||||
},
|
||||
isDisabled: false,
|
||||
},
|
||||
{merge: true},
|
||||
);
|
||||
|
||||
@@ -38,11 +38,13 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
console.log("🌱 - Process complete");
|
||||
|
||||
const correspondingStat = (await getDoc(doc(db, "stats", fields.id))).data() as Stat;
|
||||
|
||||
const solutions = correspondingStat.solutions.map((x) => ({
|
||||
...x,
|
||||
evaluation: backendRequest.data,
|
||||
solution: snapshot.metadata.fullPath,
|
||||
}));
|
||||
|
||||
await setDoc(
|
||||
doc(db, "stats", fields.id),
|
||||
{
|
||||
@@ -52,6 +54,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
total: 100,
|
||||
missing: 0,
|
||||
},
|
||||
isDisabled: false,
|
||||
},
|
||||
{merge: true},
|
||||
);
|
||||
|
||||
@@ -40,6 +40,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||
total: 100,
|
||||
missing: 0,
|
||||
},
|
||||
isDisabled: false,
|
||||
},
|
||||
{merge: true},
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
redirect: {
|
||||
destination: "/login",
|
||||
permanent: false,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
redirect: {
|
||||
destination: "/",
|
||||
permanent: false,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ export default function History({user}: {user: User}) {
|
||||
const aggregatedScores = aggregateScoresByModule(dateStats).filter((x) => x.total > 0);
|
||||
const assignmentID = dateStats.reduce((_, current) => current.assignment as any, "");
|
||||
const assignment = assignments.find((a) => a.id === assignmentID);
|
||||
const isDisabled = dateStats.some((x) => x.isDisabled);
|
||||
|
||||
const aggregatedLevels = aggregatedScores.map((x) => ({
|
||||
module: x.module,
|
||||
@@ -260,11 +261,13 @@ export default function History({user}: {user: User}) {
|
||||
key={uuidv4()}
|
||||
className={clsx(
|
||||
"flex flex-col gap-4 border border-mti-gray-platinum p-4 cursor-pointer rounded-xl transition ease-in-out duration-300 -md:hidden",
|
||||
isDisabled && "grayscale tooltip",
|
||||
correct / total >= 0.7 && "hover:border-mti-purple",
|
||||
correct / total >= 0.3 && correct / total < 0.7 && "hover:border-mti-red",
|
||||
correct / total < 0.3 && "hover:border-mti-rose",
|
||||
)}
|
||||
onClick={selectExam}
|
||||
onClick={isDisabled ? () => null : selectExam}
|
||||
data-tip="This exam is still being evaluated..."
|
||||
role="button">
|
||||
{content}
|
||||
</div>
|
||||
|
||||
@@ -28,6 +28,7 @@ export const evaluateWritingAnswer = async (exercise: WritingExercise, solution:
|
||||
total: 100,
|
||||
},
|
||||
solutions: [{id: exercise.id, solution: solution.solutions[0].solution, evaluation: response.data}],
|
||||
isDisabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,12 +78,14 @@ const evaluateSpeakingExercise = async (exercise: SpeakingExercise, exerciseId:
|
||||
if (response.status === 200) {
|
||||
return {
|
||||
...solution,
|
||||
id,
|
||||
score: {
|
||||
correct: response.data ? speakingReverseMarking[response.data.overall] : 0,
|
||||
correct: 0,
|
||||
missing: 0,
|
||||
total: 100,
|
||||
},
|
||||
solutions: [{id: exerciseId, solution: response.data ? response.data.fullPath : null, evaluation: response.data}],
|
||||
isDisabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -119,18 +122,19 @@ const evaluateInteractiveSpeakingExercise = async (exerciseId: string, solution:
|
||||
};
|
||||
|
||||
const response = await axios.post("/api/evaluate/interactiveSpeaking", formData, config);
|
||||
console.log({data: response.data, status: response.status});
|
||||
|
||||
if (response.status === 200) {
|
||||
return {
|
||||
...solution,
|
||||
id,
|
||||
score: {
|
||||
correct: response.data ? speakingReverseMarking[response.data.overall] : 0,
|
||||
correct: 0,
|
||||
missing: 0,
|
||||
total: 100,
|
||||
},
|
||||
module: "speaking",
|
||||
solutions: [{id: exerciseId, solution: response.data ? response.data.answer : null, evaluation: response.data}],
|
||||
isDisabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user