Added a new module called Level for level testing

This commit is contained in:
Tiago Ribeiro
2023-11-17 15:32:45 +00:00
parent 4a51bd7dfa
commit 44a89c6645
22 changed files with 290 additions and 99 deletions

View File

@@ -1,15 +1,5 @@
import {Module} from "@/interfaces";
import {
Exam,
ReadingExam,
ListeningExam,
WritingExam,
SpeakingExam,
Exercise,
UserSolution,
FillBlanksExercise,
MatchSentencesExercise,
} from "@/interfaces/exam";
import {Exam, ReadingExam, ListeningExam, WritingExam, SpeakingExam, Exercise, UserSolution, LevelExam} from "@/interfaces/exam";
import axios from "axios";
export const getExam = async (module: Module, avoidRepeated: boolean): Promise<Exam | undefined> => {
@@ -29,6 +19,8 @@ export const getExam = async (module: Module, avoidRepeated: boolean): Promise<E
return newExam.shift() as WritingExam;
case "speaking":
return newExam.shift() as SpeakingExam;
case "level":
return newExam.shift() as LevelExam;
}
};
@@ -49,6 +41,8 @@ export const getExamById = async (module: Module, id: string): Promise<Exam | un
return newExam as WritingExam;
case "speaking":
return newExam as SpeakingExam;
case "level":
return newExam as LevelExam;
}
};

View File

@@ -8,6 +8,7 @@ export const moduleLabels: {[key in Module]: string} = {
reading: "Reading",
speaking: "Speaking",
writing: "Writing",
level: "Level",
};
export const sortByModule = (a: {module: Module}, b: {module: Module}) => {

View File

@@ -93,6 +93,14 @@ const academicMarking: {[key: number]: number} = {
10: 2.5,
};
const levelMarking: {[key: number]: number} = {
88: 9,
64: 8,
52: 6,
32: 4,
16: 2,
};
const moduleMarkings: {[key in Module]: {[key in Type]: {[key: number]: number}}} = {
reading: {
academic: academicMarking,
@@ -110,6 +118,10 @@ const moduleMarkings: {[key in Module]: {[key in Type]: {[key: number]: number}}
academic: writingMarking,
general: writingMarking,
},
level: {
academic: levelMarking,
general: levelMarking,
},
};
export const calculateBandScore = (correct: number, total: number, module: Module, type: Type) => {