add approved field to exam

This commit is contained in:
Joao Correia
2025-03-04 00:33:09 +00:00
parent 75fb9490e0
commit 3370f3c648
2 changed files with 4 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ export interface ExamBase {
access: AccessType;
label?: string;
requiresApproval?: boolean;
approved?: boolean;
}
export interface ReadingExam extends ExamBase {
module: "reading";

View File

@@ -188,11 +188,11 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
if (isLastStep) {
setIsPanelOpen(false);
/* const examModule = currentWorkflow.modules[0];
const examModule = currentWorkflow.modules[0];
const examId = currentWorkflow.examId;
axios
.patch(`/api/exam/${examModule}/${examId}`, { access: "private" })
.patch(`/api/exam/${examModule}/${examId}`, { approved: true })
.then(() => toast.success(`The exam was successfuly approved and this workflow has been completed.`))
.catch((reason) => {
if (reason.response.status === 404) {
@@ -207,7 +207,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor
toast.error("Something went wrong, please try again later.");
})
.finally(reload); */
.finally(reload);
} else {
handleStepClick(selectedStepIndex + 1, currentWorkflow.steps[selectedStepIndex + 1]);
}