From 2d5c76e106fb8bd4ca9614710d624f9e70d55695 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 8 Nov 2024 14:52:10 +0530 Subject: [PATCH 1/2] fix: show only courses with evaluator for batch evaluation --- frontend/src/components/Modals/EvaluationModal.vue | 10 ++++++---- lms/lms/utils.py | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Modals/EvaluationModal.vue b/frontend/src/components/Modals/EvaluationModal.vue index 201e4d94..cfef41ea 100644 --- a/frontend/src/components/Modals/EvaluationModal.vue +++ b/frontend/src/components/Modals/EvaluationModal.vue @@ -154,10 +154,12 @@ function submitEvaluation(close) { const getCourses = () => { let courses = [] for (const course of props.courses) { - courses.push({ - label: course.title, - value: course.course, - }) + if (course.evaluator) { + courses.push({ + label: course.title, + value: course.course, + }) + } } return courses } diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 89ceda48..d43e90af 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -1103,7 +1103,7 @@ def get_categorized_courses(courses): categories = [live, enrolled, created] for category in categories: - category.sort(key=lambda x: x.enrollments, reverse=True) + category.sort(key=lambda x: cint(x.enrollments), reverse=True) live.sort(key=lambda x: x.featured, reverse=True) @@ -1265,7 +1265,7 @@ def get_batch_details(batch): batch_details.instructors = get_instructors(batch) batch_details.courses = frappe.get_all( - "Batch Course", filters={"parent": batch}, fields=["course", "title"] + "Batch Course", filters={"parent": batch}, fields=["course", "title", "evaluator"] ) batch_details.students = frappe.get_all( "Batch Student", {"parent": batch}, pluck="student" From 4e61d569ac6214dbde76f8c07dd62f9c40774a85 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 8 Nov 2024 14:57:11 +0530 Subject: [PATCH 2/2] fix: ignore user type for instructor field in course and batch form --- frontend/src/pages/BatchForm.vue | 1 + frontend/src/pages/CourseForm.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/src/pages/BatchForm.vue b/frontend/src/pages/BatchForm.vue index 865ae7f2..771cbfd7 100644 --- a/frontend/src/pages/BatchForm.vue +++ b/frontend/src/pages/BatchForm.vue @@ -83,6 +83,7 @@ v-model="instructors" doctype="User" :label="__('Instructors')" + :filters="{ ignore_user_type: 1 }" />