diff --git a/src/interfaces/exam.ts b/src/interfaces/exam.ts index ee08f0f5..b8e12632 100644 --- a/src/interfaces/exam.ts +++ b/src/interfaces/exam.ts @@ -1,7 +1,7 @@ import {Module} from "."; export type Exam = ReadingExam | ListeningExam | WritingExam | SpeakingExam | LevelExam; -export type Variant = "diagnostic" | "partial"; +export type Variant = "full" | "diagnostic" | "partial"; export interface ReadingExam { parts: ReadingPart[]; diff --git a/src/pages/(generation)/ListeningGeneration.tsx b/src/pages/(generation)/ListeningGeneration.tsx index bb74f6ca..c2d26237 100644 --- a/src/pages/(generation)/ListeningGeneration.tsx +++ b/src/pages/(generation)/ListeningGeneration.tsx @@ -110,6 +110,7 @@ const ListeningGeneration = () => { const [part2, setPart2] = useState(); const [part3, setPart3] = useState(); const [part4, setPart4] = useState(); + const [minTimer, setMinTimer] = useState(60); const [isLoading, setIsLoading] = useState(false); const [resultingExam, setResultingExam] = useState(); const [types, setTypes] = useState([]); @@ -129,12 +130,13 @@ const ListeningGeneration = () => { const toggleType = (type: string) => setTypes((prev) => (prev.includes(type) ? [...prev.filter((x) => x !== type)] : [...prev, type])); const submitExam = () => { - if (!part1 || !part2 || !part3 || !part4) return toast.error("Please generate all for sections!"); + const parts = [part1, part2, part3, part4].filter((x) => !!x); + if (parts.length === 0) return toast.error("Please generate at least one section!"); setIsLoading(true); axios - .post(`/api/exam/listening/generate/listening`, {parts: [part1, part2, part3, part4]}) + .post(`/api/exam/listening/generate/listening`, {parts, minTimer}) .then((result) => { playSound("sent"); console.log(`Generated Exam ID: ${result.data.id}`); @@ -172,6 +174,11 @@ const ListeningGeneration = () => { return ( <> +
+ + setMinTimer(parseInt(e))} value={minTimer} className="max-w-[300px]" /> +
+
@@ -264,14 +271,14 @@ const ListeningGeneration = () => { )} )} )} )}