From fec3b51553e7f0aa2c4ecbee163b933939d8100d Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 17 Feb 2025 10:32:57 +0000 Subject: [PATCH 01/13] Created two new permissions --- src/pages/entities/[id]/roles/[role].tsx | 2 ++ src/resources/entityPermissions.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/entities/[id]/roles/[role].tsx b/src/pages/entities/[id]/roles/[role].tsx index 1145c51b..00bb6f6e 100644 --- a/src/pages/entities/[id]/roles/[role].tsx +++ b/src/pages/entities/[id]/roles/[role].tsx @@ -64,6 +64,8 @@ const EXAM_MANAGEMENT: PermissionLayout[] = [ {label: "Delete Level", key: "delete_level"}, {label: "Set as Private/Public", key: "update_exam_privacy"}, {label: "View Confidential Exams", key: "view_confidential_exams"}, + {label: "Create Confidential Exams", key: "create_confidential_exams"}, + {label: "Create Public Exams", key: "create_public_exams"}, {label: "View Statistics", key: "view_statistics"}, ]; diff --git a/src/resources/entityPermissions.ts b/src/resources/entityPermissions.ts index a5b38d62..2151a800 100644 --- a/src/resources/entityPermissions.ts +++ b/src/resources/entityPermissions.ts @@ -72,7 +72,9 @@ export type RolePermission = | "configure_workflows" | "edit_workflow" | "delete_workflow" - | "view_confidential_exams"; + | "view_confidential_exams" + | "create_confidential_exams" + | "create_public_exams"; export const DEFAULT_PERMISSIONS: RolePermission[] = [ "view_students", @@ -157,4 +159,6 @@ export const ADMIN_PERMISSIONS: RolePermission[] = [ "view_workflows", "edit_workflow", "delete_workflow", + "create_confidential_exams", + "create_public_exams", ]; From 14e2702aca1fbeae33befe2e9bce2ba2c5d9071d Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Thu, 20 Feb 2025 10:40:31 +0000 Subject: [PATCH 02/13] add error message and stop loading if something went wrong while loading exam in approval workflow --- src/lib/createWorkflowsOnExamCreation.ts | 2 +- src/pages/approval-workflows/[id]/index.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/createWorkflowsOnExamCreation.ts b/src/lib/createWorkflowsOnExamCreation.ts index e2a791af..0f8e1c53 100644 --- a/src/lib/createWorkflowsOnExamCreation.ts +++ b/src/lib/createWorkflowsOnExamCreation.ts @@ -72,7 +72,7 @@ export async function createApprovalWorkflowOnExamCreation(examAuthor: string, e if (totalCount === 0) { // current behaviour: if no workflow was found skip approval process await db.collection(examModule).updateOne( { id: examId }, - { $set: { id: examId, isDiagnostic: false }}, + { $set: { id: examId, access: "private" }}, { upsert: true } ); } diff --git a/src/pages/approval-workflows/[id]/index.tsx b/src/pages/approval-workflows/[id]/index.tsx index 2b512ba0..dfbedc0f 100644 --- a/src/pages/approval-workflows/[id]/index.tsx +++ b/src/pages/approval-workflows/[id]/index.tsx @@ -261,7 +261,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor const exam = await getExamById(examModule, examId.trim()); if (!exam) { toast.error( - "Unknown Exam ID! Please make sure you selected the right module and entered the right exam ID", + "Something went wrong while fetching exam!", { toastId: "invalid-exam-id" } ); setViewExamIsLoading(false); @@ -272,6 +272,13 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor payload: { exams: [exam], modules: [examModule] }, }); router.push("/exam"); + } else { + toast.error( + "Something went wrong while fetching exam!", + { toastId: "invalid-exam-id" } + ); + setViewExamIsLoading(false); + return; } } From 4ac11df6ae73294d35cd44f506908644b3fbc32c Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Thu, 20 Feb 2025 11:27:44 +0000 Subject: [PATCH 03/13] fix examId being cleared when editing approval workflow --- src/pages/approval-workflows/[id]/edit.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/approval-workflows/[id]/edit.tsx b/src/pages/approval-workflows/[id]/edit.tsx index aec4fd1f..0c549e13 100644 --- a/src/pages/approval-workflows/[id]/edit.tsx +++ b/src/pages/approval-workflows/[id]/edit.tsx @@ -73,13 +73,9 @@ export default function Home({ user, workflow, workflowEntityApprovers }: Props) })); const editableWorkflow: EditableApprovalWorkflow = { + ...workflow, id: workflow._id?.toString() ?? "", - name: workflow.name, - entityId: workflow.entityId, requester: user.id, // should it change to the editor? - startDate: workflow.startDate, - modules: workflow.modules, - status: workflow.status, steps: editableSteps, }; From b388ee399f62141f98b3c2e86498de71df9de7bf Mon Sep 17 00:00:00 2001 From: Joao Correia Date: Thu, 20 Feb 2025 12:12:00 +0000 Subject: [PATCH 04/13] small refactor --- src/pages/approval-workflows/[id]/index.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/pages/approval-workflows/[id]/index.tsx b/src/pages/approval-workflows/[id]/index.tsx index dfbedc0f..4048df94 100644 --- a/src/pages/approval-workflows/[id]/index.tsx +++ b/src/pages/approval-workflows/[id]/index.tsx @@ -260,10 +260,7 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor if (examModule && examId) { const exam = await getExamById(examModule, examId.trim()); if (!exam) { - toast.error( - "Something went wrong while fetching exam!", - { toastId: "invalid-exam-id" } - ); + toast.error("Something went wrong while fetching exam!"); setViewExamIsLoading(false); return; } @@ -272,13 +269,6 @@ export default function Home({ user, initialWorkflow, id, workflowAssignees, wor payload: { exams: [exam], modules: [examModule] }, }); router.push("/exam"); - } else { - toast.error( - "Something went wrong while fetching exam!", - { toastId: "invalid-exam-id" } - ); - setViewExamIsLoading(false); - return; } } From 340ff5a30a60e7f4f51627b43b34cafad9fc339e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lima?= Date: Sun, 23 Feb 2025 18:47:57 +0000 Subject: [PATCH 05/13] bugsfixed and design changes for generation 13'' screen --- .../SettingsEditor/listening/components.tsx | 2 +- .../SettingsEditor/listening/index.tsx | 9 +- .../SettingsEditor/reading/components.tsx | 2 +- .../SettingsEditor/reading/index.tsx | 1 - src/components/ExamEditor/index.tsx | 144 ++- src/components/List.tsx | 4 +- src/components/Medium/RecordFilter.tsx | 23 +- src/components/Medium/StatGridItem.tsx | 1 - src/components/Sidebar.tsx | 23 +- src/hooks/usePagination.tsx | 5 +- src/pages/(admin)/BatchCodeGenerator.tsx | 941 ++++++++++-------- src/pages/(admin)/CodeGenerator.tsx | 353 ++++--- src/pages/(admin)/Lists/BatchCreateUser.tsx | 1 - src/pages/(admin)/Lists/ExamList.tsx | 2 +- src/pages/(admin)/Lists/GroupList.tsx | 267 +++-- src/pages/(admin)/Lists/PackageList.tsx | 539 +++++----- .../(admin)/Lists/StudentPerformanceList.tsx | 1 - src/pages/(admin)/Lists/UserList.tsx | 2 +- src/pages/(admin)/UserCreator.tsx | 573 ++++++----- src/pages/(exam)/ExamPage.tsx | 10 +- src/pages/(register)/RegisterCorporate.tsx | 481 ++++----- src/pages/api/exam/index.ts | 2 +- src/pages/api/training/index.ts | 2 + src/pages/generation.tsx | 507 ++++++---- src/pages/record.tsx | 2 +- src/pages/training/index.tsx | 54 +- src/pages/users/performance.tsx | 10 +- src/stores/exam/reducers/index.ts | 6 +- src/utils/users.be.ts | 5 +- 29 files changed, 2292 insertions(+), 1680 deletions(-) diff --git a/src/components/ExamEditor/SettingsEditor/listening/components.tsx b/src/components/ExamEditor/SettingsEditor/listening/components.tsx index 08d076a5..9dbb5ea1 100644 --- a/src/components/ExamEditor/SettingsEditor/listening/components.tsx +++ b/src/components/ExamEditor/SettingsEditor/listening/components.tsx @@ -233,7 +233,7 @@ const ListeningComponents: React.FC = ({ currentSection, localSettings, u setIsOpen={(isOpen: boolean) => updateLocalAndScheduleGlobal({ isAudioContextOpen: isOpen }, false)} contentWrapperClassName={level ? `border border-ielts-listening` : ''} > -
+
{ const router = useRouter(); diff --git a/src/components/ExamEditor/SettingsEditor/reading/components.tsx b/src/components/ExamEditor/SettingsEditor/reading/components.tsx index 6553d83e..aa9b9238 100644 --- a/src/components/ExamEditor/SettingsEditor/reading/components.tsx +++ b/src/components/ExamEditor/SettingsEditor/reading/components.tsx @@ -82,7 +82,7 @@ const ReadingComponents: React.FC = ({ disabled={generatePassageDisabled} >