Finallyyyyyy finished the whole Speaking flow along with the solution page

This commit is contained in:
Tiago Ribeiro
2023-07-14 14:15:07 +01:00
parent 2c10a203a5
commit 121ac8ba4d
10 changed files with 206 additions and 76 deletions

View File

@@ -133,7 +133,7 @@ export default function Page() {
const speakingExam = exams.find((x) => x.id === examId)!;
const exercise = speakingExam.exercises.find((x) => x.id === exerciseId)! as SpeakingExercise;
const blobResponse = await axios.get(exercise.userSolutions[0].solution.trim());
const blobResponse = await axios.get(solution.solutions[0].solution.trim(), {responseType: "arraybuffer"});
const audioBlob = Buffer.from(blobResponse.data, "binary");
const audioFile = new File([audioBlob], "audio.wav", {type: "audio/wav"});
@@ -155,7 +155,7 @@ export default function Page() {
{
...solution,
score: {
correct: speakingReverseMarking[response.data.overall],
correct: speakingReverseMarking[response.data.overall] || 0,
missing: 0,
total: 100,
},
@@ -180,7 +180,7 @@ export default function Page() {
{
...solution,
score: {
correct: writingReverseMarking[response.data.overall],
correct: writingReverseMarking[response.data.overall] || 0,
missing: 0,
total: 100,
},
@@ -294,11 +294,6 @@ export default function Page() {
return <Writing exam={exam} onFinish={onFinish} showSolutions={showSolutions} />;
}
if (exam && exam.module === "speaking" && showSolutions) {
setModuleIndex((prev) => prev + 1);
return <></>;
}
if (exam && exam.module === "speaking") {
return <Speaking exam={exam} onFinish={onFinish} showSolutions={showSolutions} />;
}