Merge pull request #1561 from pateljannat/evaluator-link-in-batch

fix batch instructor should be linked to evaluator
This commit is contained in:
Jannat Patel
2025-06-05 15:06:46 +05:30
committed by GitHub
7 changed files with 76 additions and 31 deletions

View File

@@ -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");

View File

@@ -55,9 +55,10 @@
</div>
</li>
</ComboboxOption>
<div class="h-10"></div>
<div
v-if="attrs.onCreate"
class="absolute bottom-2 left-1 w-[98%] pt-2 bg-white border-t"
class="absolute bottom-2 left-1 w-[99%] pt-2 bg-white border-t"
>
<Button
variant="ghost"

View File

@@ -33,6 +33,7 @@
:placeholder="__('Email')"
type="email"
class="w-full"
@keydown.enter="addEvaluator"
/>
<Button @click="addEvaluator()" variant="subtle">
{{ __('Add') }}

View File

@@ -23,10 +23,10 @@
/>
<MultiSelect
v-model="instructors"
doctype="User"
doctype="Course Evaluator"
:label="__('Instructors')"
:required="true"
:onCreate="(close) => openSettings('Members', close)"
:onCreate="(close) => openSettings('Evaluators', close)"
:filters="{ ignore_user_type: 1 }"
/>
</div>

View File

@@ -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"
}

View File

@@ -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
lms.patches.v2_0.sidebar_for_certified_members
lms.patches.v2_0.move_batch_instructors_to_evaluators

View File

@@ -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()