From 3370f3c64831b36398afb2c87d732f8c65b9e1c4 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Tue, 4 Mar 2025 00:33:09 +0000 Subject: [PATCH] add approved field to exam --- src/interfaces/exam.ts | 1 + src/pages/approval-workflows/[id]/index.tsx | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/interfaces/exam.ts b/src/interfaces/exam.ts index 7f838fc0..9c1ff8b6 100644 --- a/src/interfaces/exam.ts +++ b/src/interfaces/exam.ts @@ -29,6 +29,7 @@ export interface ExamBase { access: AccessType; label?: string; requiresApproval?: boolean; + approved?: boolean; } export interface ReadingExam extends ExamBase { module: "reading"; diff --git a/src/pages/approval-workflows/[id]/index.tsx b/src/pages/approval-workflows/[id]/index.tsx index a814cf22..87140821 100644 --- a/src/pages/approval-workflows/[id]/index.tsx +++ b/src/pages/approval-workflows/[id]/index.tsx @@ -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]); }