- Added the ability for a student/developer to choose a gender for a speaking instructor;

- Made it so, if chosen, the user will only get speaking exams with their chosen gender;
- Added the ability for speaking exams to select a gender when generating;
This commit is contained in:
Tiago Ribeiro
2024-02-09 12:14:47 +00:00
parent ce7032c8a7
commit 872cc62fe4
11 changed files with 337 additions and 238 deletions

View File

@@ -123,6 +123,7 @@ export default function ExamPage({page}: Props) {
setSessionId(shortUID.randomUUID(8));
}
}, [setSessionId, selectedModules, sessionId]);
useEffect(() => {
if (user?.type === "developer") console.log(exam);
}, [exam, user]);
@@ -160,7 +161,14 @@ export default function ExamPage({page}: Props) {
useEffect(() => {
(async () => {
if (selectedModules.length > 0 && exams.length === 0) {
const examPromises = selectedModules.map((module) => getExam(module, avoidRepeated, variant));
const examPromises = selectedModules.map((module) =>
getExam(
module,
avoidRepeated,
variant,
user?.type === "student" || user?.type === "developer" ? user.preferredGender : undefined,
),
);
Promise.all(examPromises).then((values) => {
if (values.every((x) => !!x)) {
setExams(values.map((x) => x!));