From 6f6c5a42097f1a18a0a0a206ef9e48f266c22fa7 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Sun, 9 Feb 2025 15:44:37 +0000 Subject: [PATCH 1/4] make first step approved by default --- src/lib/createWorkflowsOnExamCreation.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/createWorkflowsOnExamCreation.ts b/src/lib/createWorkflowsOnExamCreation.ts index f72d9db7..e2a791af 100644 --- a/src/lib/createWorkflowsOnExamCreation.ts +++ b/src/lib/createWorkflowsOnExamCreation.ts @@ -55,6 +55,9 @@ export async function createApprovalWorkflowOnExamCreation(examAuthor: string, e configuredWorkflow.examId = examId; configuredWorkflow.entityId = entity; configuredWorkflow.startDate = Date.now(); + configuredWorkflow.steps[0].completed = true; + configuredWorkflow.steps[0].completedBy = examAuthor; + configuredWorkflow.steps[0].completedDate = Date.now(); try { await createApprovalWorkflow("active-workflows", configuredWorkflow); From 9ae6b8e8941a7eb0ba62435f8ae03312008a9944 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Sun, 9 Feb 2025 16:55:50 +0000 Subject: [PATCH 2/4] make sure admin id is passed to step component if the admin is not assigned to the workflow but approved a step. --- src/pages/approval-workflows/[id]/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/approval-workflows/[id]/index.tsx b/src/pages/approval-workflows/[id]/index.tsx index 6cdaec9a..64a8026e 100644 --- a/src/pages/approval-workflows/[id]/index.tsx +++ b/src/pages/approval-workflows/[id]/index.tsx @@ -58,7 +58,13 @@ export const getServerSideProps = withIronSessionSsr(async ({ req, res, params } const allAssigneeIds: string[] = [ ...new Set( workflow.steps - .map(step => step.assignees) + .map((step) => { + const assignees = step.assignees; + if (step.completedBy) { + assignees.push(step.completedBy); + } + return assignees; + }) .flat() ) ]; From 75b4643918a2b2da113b92a6e43019943e2a7047 Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Sun, 9 Feb 2025 17:37:19 +0000 Subject: [PATCH 3/4] Add button to submit exam without approval process --- .../ExamEditor/SettingsEditor/index.tsx | 18 ++++++++++-- .../ExamEditor/SettingsEditor/level.tsx | 5 ++-- .../SettingsEditor/listening/index.tsx | 5 ++-- .../SettingsEditor/reading/index.tsx | 5 ++-- .../SettingsEditor/speaking/index.tsx | 5 ++-- .../SettingsEditor/writing/index.tsx | 5 ++-- src/interfaces/exam.ts | 1 + src/pages/api/exam/[module]/index.ts | 28 +++++++++++-------- 8 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/components/ExamEditor/SettingsEditor/index.tsx b/src/components/ExamEditor/SettingsEditor/index.tsx index faf6bcbc..be98e4b4 100644 --- a/src/components/ExamEditor/SettingsEditor/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/index.tsx @@ -19,7 +19,7 @@ interface SettingsEditorProps { children?: ReactNode; canPreview: boolean; canSubmit: boolean; - submitModule: () => void; + submitModule: (requiresApproval: boolean) => void; preview: () => void; } @@ -148,19 +148,31 @@ const SettingsEditor: React.FC = ({ {children} -
+
+ + + + Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()} + + + +
);