From 1a1cbd6ea135923b7c0b08b3a634e3a423ceeb47 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 5 Jun 2025 12:58:12 +0530 Subject: [PATCH 1/2] fix: batch instructor should be linked to evaluator --- .../src/components/Controls/MultiSelect.vue | 3 ++- .../src/components/Settings/Evaluators.vue | 1 + frontend/src/pages/BatchForm.vue | 4 ++-- .../course_evaluator/course_evaluator.json | 7 +++--- lms/patches.txt | 3 ++- .../move_batch_instructors_to_evaluators.py | 22 +++++++++++++++++++ 6 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 lms/patches/v2_0/move_batch_instructors_to_evaluators.py diff --git a/frontend/src/components/Controls/MultiSelect.vue b/frontend/src/components/Controls/MultiSelect.vue index 678dfb28..dd36d07d 100644 --- a/frontend/src/components/Controls/MultiSelect.vue +++ b/frontend/src/components/Controls/MultiSelect.vue @@ -55,9 +55,10 @@ +
diff --git a/lms/lms/doctype/course_evaluator/course_evaluator.json b/lms/lms/doctype/course_evaluator/course_evaluator.json index 702aabc8..3d466684 100644 --- a/lms/lms/doctype/course_evaluator/course_evaluator.json +++ b/lms/lms/doctype/course_evaluator/course_evaluator.json @@ -86,8 +86,8 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2025-03-26 14:02:46.588721", - "modified_by": "Administrator", + "modified": "2025-06-05 11:04:32.475711", + "modified_by": "sayali@frappe.io", "module": "LMS", "name": "Course Evaluator", "naming_rule": "By fieldname", @@ -133,5 +133,6 @@ "row_format": "Dynamic", "sort_field": "modified", "sort_order": "DESC", - "states": [] + "states": [], + "title_field": "full_name" } diff --git a/lms/patches.txt b/lms/patches.txt index 705b09e2..237166cd 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -107,4 +107,5 @@ lms.patches.v2_0.update_course_evaluator_data lms.patches.v2_0.move_zoom_settings #20-05-2025 lms.patches.v2_0.link_zoom_account_to_live_class lms.patches.v2_0.link_zoom_account_to_batch -lms.patches.v2_0.sidebar_for_certified_members \ No newline at end of file +lms.patches.v2_0.sidebar_for_certified_members +lms.patches.v2_0.move_batch_instructors_to_evaluators \ No newline at end of file diff --git a/lms/patches/v2_0/move_batch_instructors_to_evaluators.py b/lms/patches/v2_0/move_batch_instructors_to_evaluators.py new file mode 100644 index 00000000..a7866798 --- /dev/null +++ b/lms/patches/v2_0/move_batch_instructors_to_evaluators.py @@ -0,0 +1,22 @@ +import frappe + + +def execute(): + batch_instructors = frappe.get_all( + "Course Instructor", + { + "parenttype": "LMS Batch", + }, + ["name", "instructor", "parent"], + ) + + for instructor in batch_instructors: + if not frappe.db.exists( + "Course Evaluator", + { + "evaluator": instructor.instructor, + }, + ): + doc = frappe.new_doc("Course Evaluator") + doc.evaluator = instructor.instructor + doc.insert() From 414643ee90372ab68a5e57ad53e69e06a9869666 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 5 Jun 2025 14:46:09 +0530 Subject: [PATCH 2/2] test: link evaluator as batch instructor --- cypress/e2e/batch_creation.cy.js | 67 ++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/cypress/e2e/batch_creation.cy.js b/cypress/e2e/batch_creation.cy.js index 698e9525..5b62e6e2 100644 --- a/cypress/e2e/batch_creation.cy.js +++ b/cypress/e2e/batch_creation.cy.js @@ -3,8 +3,47 @@ describe("Batch Creation", () => { cy.login(); cy.wait(500); cy.visit("/lms/batches"); + cy.closeOnboardingModal(); - // Close onboarding modal + // Open Settings + cy.get("span").contains("Learning").click(); + cy.get("span").contains("Settings").click(); + + // Add a new member + cy.get('[id^="headlessui-dialog-panel-v-"]') + .find("span") + .contains(/^Members$/) + .click(); + cy.get('[id^="headlessui-dialog-panel-v-"]') + .find("button") + .contains("New") + .click(); + + const dateNow = Date.now(); + const randomEmail = `testuser_${dateNow}@example.com`; + const randomName = `Test User ${dateNow}`; + + cy.get("input[placeholder='Email']").type(randomEmail); + cy.get("input[placeholder='First Name']").type(randomName); + cy.get("button").contains("Add").click(); + + // Add evaluator + cy.get('[id^="headlessui-dialog-panel-v-"]') + .find("span") + .contains(/^Evaluators$/) + .click(); + + cy.get('[id^="headlessui-dialog-panel-v-"]') + .find("button") + .contains("New") + .click(); + const randomEvaluator = `evaluator${dateNow}@example.com`; + + cy.get("input[placeholder='Email']").type(randomEvaluator); + cy.get("button").contains("Add").click(); + cy.get("div").contains(randomEvaluator).should("be.visible").click(); + + cy.visit("/lms/batches"); cy.closeOnboardingModal(); // Create a batch @@ -34,7 +73,7 @@ describe("Batch Creation", () => { .contains("Instructors") .parent() .within(() => { - cy.get("input").click().type("frappe"); + cy.get("input").click().type("evaluator"); cy.get("input") .invoke("attr", "aria-controls") .as("instructor_list_id"); @@ -57,26 +96,6 @@ describe("Batch Creation", () => { }); cy.wait(500); - // Add Student to system - - cy.get("span").contains("Learning").click(); - cy.get("span").contains("Settings").click(); - cy.get('[id^="headlessui-dialog-panel-v-"]') - .find("span") - .contains(/^Members$/) - .should("have.text", "Members") - .click(); - cy.get("button").contains("New").click(); - - const dateNow = Date.now(); - const randomEmail = `testuser_${dateNow}@example.com`; - const randomName = `Test User ${dateNow}`; - - cy.get("input[placeholder='Email']").type(randomEmail); - cy.get("input[placeholder='First Name']").type(randomName); - cy.get("button").contains("Add").click(); - cy.get("div").contains(randomName).should("be.visible").click(); - // View Batch cy.wait(1000); cy.visit("/lms/batches"); @@ -103,7 +122,7 @@ describe("Batch Creation", () => { .contains("10:00 AM - 11:00 AM") .should("be.visible"); cy.get("span").contains("IST").should("be.visible"); - cy.get("a").contains("Frappe").should("be.visible"); + cy.get("a").contains("Evaluator").should("be.visible"); cy.get("div") .contains("10") .should("be.visible") @@ -118,7 +137,7 @@ describe("Batch Creation", () => { cy.get("div") .contains("Test Batch Short Description to test the UI") .should("be.visible"); - cy.get("a").contains("Frappe").should("be.visible"); + cy.get("a").contains("Evaluator").should("be.visible"); cy.get("span") .contains("01 Oct 2030 - 31 Oct 2030") .should("be.visible");