diff --git a/src/components/ExamEditor/SettingsEditor/index.tsx b/src/components/ExamEditor/SettingsEditor/index.tsx index be98e4b4..fedbd0c7 100644 --- a/src/components/ExamEditor/SettingsEditor/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/index.tsx @@ -159,7 +159,7 @@ const SettingsEditor: React.FC = ({ disabled={!canSubmit} > - Submit Module as Exam + Submit module as exam for approval diff --git a/src/components/ExamEditor/SettingsEditor/level.tsx b/src/components/ExamEditor/SettingsEditor/level.tsx index 76b82bb6..36dc8796 100644 --- a/src/components/ExamEditor/SettingsEditor/level.tsx +++ b/src/components/ExamEditor/SettingsEditor/level.tsx @@ -196,7 +196,7 @@ const LevelSettings: React.FC = () => { }; }).filter(part => part.exercises.length > 0), requiresApproval: requiresApproval, - isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed. + isDiagnostic: false, minTimer, module: "level", id: title, diff --git a/src/components/ExamEditor/SettingsEditor/listening/index.tsx b/src/components/ExamEditor/SettingsEditor/listening/index.tsx index c2a862d3..fa0ffc3e 100644 --- a/src/components/ExamEditor/SettingsEditor/listening/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/listening/index.tsx @@ -139,7 +139,7 @@ const ListeningSettings: React.FC = () => { }; }), requiresApproval: requiresApproval, - isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed. + isDiagnostic: false, minTimer, module: "listening", id: title, diff --git a/src/components/ExamEditor/SettingsEditor/reading/index.tsx b/src/components/ExamEditor/SettingsEditor/reading/index.tsx index 15615a8b..4c4f69b5 100644 --- a/src/components/ExamEditor/SettingsEditor/reading/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/reading/index.tsx @@ -75,7 +75,7 @@ const ReadingSettings: React.FC = () => { }; }), requiresApproval: requiresApproval, - isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed. + isDiagnostic: false, minTimer, module: "reading", id: title, diff --git a/src/components/ExamEditor/SettingsEditor/speaking/index.tsx b/src/components/ExamEditor/SettingsEditor/speaking/index.tsx index 6d2be4df..186b2c53 100644 --- a/src/components/ExamEditor/SettingsEditor/speaking/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/speaking/index.tsx @@ -182,7 +182,7 @@ const SpeakingSettings: React.FC = () => { module: "speaking", id: title, requiresApproval: requiresApproval, - isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed. + isDiagnostic: false, variant: undefined, difficulty, instructorGender: "varied", diff --git a/src/components/ExamEditor/SettingsEditor/writing/index.tsx b/src/components/ExamEditor/SettingsEditor/writing/index.tsx index 8c6b79c1..9bbed3a8 100644 --- a/src/components/ExamEditor/SettingsEditor/writing/index.tsx +++ b/src/components/ExamEditor/SettingsEditor/writing/index.tsx @@ -132,7 +132,7 @@ const WritingSettings: React.FC = () => { module: "writing", id: title, requiresApproval: requiresApproval, - isDiagnostic: requiresApproval ? true : false, // using isDiagnostic to keep exam hidden until the respective approval workflow is completed. + isDiagnostic: false, variant: undefined, difficulty, access, diff --git a/src/pages/api/exam/[module]/index.ts b/src/pages/api/exam/[module]/index.ts index 966bf502..6643d81d 100644 --- a/src/pages/api/exam/[module]/index.ts +++ b/src/pages/api/exam/[module]/index.ts @@ -78,8 +78,8 @@ async function POST(req: NextApiRequest, res: NextApiResponse) { throw new Error("Name already exists"); } - if (isAdmin(user)) { - exam.isDiagnostic = false; + if (exam.requiresApproval === true) { + exam.access = "confidential"; } await db.collection(module).updateOne( diff --git a/src/pages/approval-workflows/[id]/index.tsx b/src/pages/approval-workflows/[id]/index.tsx index c6cdc340..2b512ba0 100644 --- a/src/pages/approval-workflows/[id]/index.tsx +++ b/src/pages/approval-workflows/[id]/index.tsx @@ -150,7 +150,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor const handleApproveStep = () => { const isLastStep = (selectedStepIndex + 1 === currentWorkflow.steps.length); if (isLastStep) { - if (!confirm(`Are you sure you want to approve the last step? Doing so will approve the exam.`)) return; + if (!confirm(`Are you sure you want to approve the last step? Doing so will change the access type of the exam from confidential to private.`)) return; } const updatedWorkflow: ApprovalWorkflow = { @@ -192,7 +192,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor const examId = currentWorkflow.examId; axios - .patch(`/api/exam/${examModule}/${examId}`, { isDiagnostic: false }) + .patch(`/api/exam/${examModule}/${examId}`, { access: "private" }) .then(() => toast.success(`The exam was successfuly approved and this workflow has been completed.`)) .catch((reason) => { if (reason.response.status === 404) {