Merged in ENCOA-139_ReleaseBug (pull request #87)

ENCOA-139 Release Improvements
This commit is contained in:
João Ramos
2024-09-03 15:47:17 +00:00
committed by Tiago Ribeiro
5 changed files with 215 additions and 278 deletions

View File

@@ -53,6 +53,8 @@ export default function AssignmentCreator({isCreating, assignment, groups, users
const [instructorGender, setInstructorGender] = useState<InstructorGender>(assignment?.instructorGender || "varied");
// creates a new exam for each assignee or just one exam for all assignees
const [generateMultiple, setGenerateMultiple] = useState<boolean>(false);
const [released, setReleased] = useState<boolean>(false);
const [useRandomExams, setUseRandomExams] = useState(true);
const [examIDs, setExamIDs] = useState<{id: string; module: Module}[]>([]);
@@ -84,6 +86,7 @@ export default function AssignmentCreator({isCreating, assignment, groups, users
generateMultiple,
variant,
instructorGender,
released,
})
.then(() => {
toast.success(`The assignment "${name}" has been ${assignment ? "updated" : "created"} successfully!`);
@@ -373,6 +376,9 @@ export default function AssignmentCreator({isCreating, assignment, groups, users
<Checkbox isChecked={generateMultiple} onChange={() => setGenerateMultiple((d) => !d)}>
Generate different exams
</Checkbox>
<Checkbox isChecked={released} onChange={() => setReleased((d) => !d)}>
Release automatically
</Checkbox>
</div>
<div className="flex gap-4 w-full justify-end">
<Button className="w-full max-w-[200px]" variant="outline" onClick={cancelCreation} disabled={isLoading} isLoading={isLoading}>

View File

@@ -223,7 +223,7 @@ export default function Finish({user, scores, modules, information, solutions, i
</span>
</div>
)}
{!isLoading && false && (
{!isLoading && (
<div className="mb-20 mt-32 flex w-full items-center justify-between gap-9">
<span className="max-w-3xl">{moduleResultText(selectedModule, bandScore)}</span>
<div className="flex gap-9 px-16">

View File

@@ -214,7 +214,7 @@ export default function ExamPage({page, user}: Props) {
if (selectedModules.length > 0 && exams.length > 0 && moduleIndex < selectedModules.length) {
const nextExam = exams[moduleIndex];
if (partIndex === -1 && nextExam.module !== "listening") setPartIndex(0);
if (partIndex === -1 && nextExam?.module !== "listening") setPartIndex(0);
if (exerciseIndex === -1 && !["reading", "listening"].includes(nextExam?.module)) setExerciseIndex(0);
setExam(nextExam ? updateExamWithUserSolutions(nextExam) : undefined);
}

View File

@@ -123,6 +123,7 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
endDate: string;
variant?: Variant;
instructorGender?: InstructorGender;
released: boolean;
};
const exams: ExamWithUser[] = !!examIDs
@@ -140,7 +141,6 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
results: [],
exams,
instructorGender,
released: false,
...body,
});