diff --git a/lms/hooks.py b/lms/hooks.py index fc78d28e..127d4886 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -152,7 +152,7 @@ website_route_rules = [ }, {"from_route": "/quizzes", "to_route": "batch/quiz_list"}, {"from_route": "/quizzes/", "to_route": "batch/quiz"}, - {"from_route": "/classes/", "to_route": "classes/class"}, + {"from_route": "/batches/", "to_route": "batches/batch"}, {"from_route": "/courses//progress", "to_route": "batch/progress"}, {"from_route": "/courses//join", "to_route": "batch/join"}, {"from_route": "/courses//manage", "to_route": "cohorts"}, @@ -176,8 +176,8 @@ website_route_rules = [ {"from_route": "/users", "to_route": "profiles/profile"}, {"from_route": "/jobs/", "to_route": "jobs/job"}, { - "from_route": "/classes//students/", - "to_route": "/classes/progress", + "from_route": "/batches//students/", + "to_route": "/batches/progress", }, {"from_route": "/assignments/", "to_route": "assignments/assignment"}, { @@ -193,8 +193,8 @@ website_route_rules = [ "to_route": "billing/billing", }, { - "from_route": "/classes/details/", - "to_route": "classes/class_details", + "from_route": "/batches/details/", + "to_route": "batches/batch_details", }, ] diff --git a/lms/lms/doctype/class_course/__init__.py b/lms/lms/doctype/batch_course/__init__.py similarity index 100% rename from lms/lms/doctype/class_course/__init__.py rename to lms/lms/doctype/batch_course/__init__.py diff --git a/lms/lms/doctype/class_course/class_course.json b/lms/lms/doctype/batch_course/batch_course.json similarity index 93% rename from lms/lms/doctype/class_course/class_course.json rename to lms/lms/doctype/batch_course/batch_course.json index 6412b74a..bf393be0 100644 --- a/lms/lms/doctype/class_course/class_course.json +++ b/lms/lms/doctype/batch_course/batch_course.json @@ -38,10 +38,10 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2023-07-13 17:51:36.278393", + "modified": "2023-08-28 10:03:02.960844", "modified_by": "Administrator", "module": "LMS", - "name": "Class Course", + "name": "Batch Course", "naming_rule": "Autoincrement", "owner": "Administrator", "permissions": [], diff --git a/lms/lms/doctype/class_course/class_course.py b/lms/lms/doctype/batch_course/batch_course.py similarity index 84% rename from lms/lms/doctype/class_course/class_course.py rename to lms/lms/doctype/batch_course/batch_course.py index 64b9f410..db2de9a2 100644 --- a/lms/lms/doctype/class_course/class_course.py +++ b/lms/lms/doctype/batch_course/batch_course.py @@ -5,5 +5,5 @@ from frappe.model.document import Document -class ClassCourse(Document): +class BatchCourse(Document): pass diff --git a/lms/lms/doctype/class_student/__init__.py b/lms/lms/doctype/batch_student/__init__.py similarity index 100% rename from lms/lms/doctype/class_student/__init__.py rename to lms/lms/doctype/batch_student/__init__.py diff --git a/lms/lms/doctype/class_student/class_student.js b/lms/lms/doctype/batch_student/batch_student.js similarity index 78% rename from lms/lms/doctype/class_student/class_student.js rename to lms/lms/doctype/batch_student/batch_student.js index 69567d23..680bc334 100644 --- a/lms/lms/doctype/class_student/class_student.js +++ b/lms/lms/doctype/batch_student/batch_student.js @@ -1,7 +1,7 @@ // Copyright (c) 2022, Frappe and contributors // For license information, please see license.txt -frappe.ui.form.on("Class Student", { +frappe.ui.form.on("Batch Student", { // refresh: function(frm) { // } }); diff --git a/lms/lms/doctype/class_student/class_student.json b/lms/lms/doctype/batch_student/batch_student.json similarity index 98% rename from lms/lms/doctype/class_student/class_student.json rename to lms/lms/doctype/batch_student/batch_student.json index 28a00a8d..b2a8816a 100644 --- a/lms/lms/doctype/class_student/class_student.json +++ b/lms/lms/doctype/batch_student/batch_student.json @@ -60,7 +60,7 @@ "modified": "2023-08-24 17:48:53.045539", "modified_by": "Administrator", "module": "LMS", - "name": "Class Student", + "name": "Batch Student", "owner": "Administrator", "permissions": [], "sort_field": "modified", diff --git a/lms/lms/doctype/class_student/class_student.py b/lms/lms/doctype/batch_student/batch_student.py similarity index 84% rename from lms/lms/doctype/class_student/class_student.py rename to lms/lms/doctype/batch_student/batch_student.py index cfe37fa1..7cd9a61a 100644 --- a/lms/lms/doctype/class_student/class_student.py +++ b/lms/lms/doctype/batch_student/batch_student.py @@ -5,5 +5,5 @@ from frappe.model.document import Document -class ClassStudent(Document): +class BatchStudent(Document): pass diff --git a/lms/lms/doctype/class_student/test_class_student.py b/lms/lms/doctype/batch_student/test_batch_student.py similarity index 77% rename from lms/lms/doctype/class_student/test_class_student.py rename to lms/lms/doctype/batch_student/test_batch_student.py index 41f8ed09..88c576e4 100644 --- a/lms/lms/doctype/class_student/test_class_student.py +++ b/lms/lms/doctype/batch_student/test_batch_student.py @@ -5,5 +5,5 @@ from frappe.tests.utils import FrappeTestCase -class TestClassStudent(FrappeTestCase): +class TestBatchStudent(FrappeTestCase): pass diff --git a/lms/lms/doctype/lms_class/__init__.py b/lms/lms/doctype/lms_batch/__init__.py similarity index 100% rename from lms/lms/doctype/lms_class/__init__.py rename to lms/lms/doctype/lms_batch/__init__.py diff --git a/lms/lms/doctype/lms_class/lms_class.js b/lms/lms/doctype/lms_batch/lms_batch.js similarity index 87% rename from lms/lms/doctype/lms_class/lms_class.js rename to lms/lms/doctype/lms_batch/lms_batch.js index 7f3c4299..45f9d0b5 100644 --- a/lms/lms/doctype/lms_class/lms_class.js +++ b/lms/lms/doctype/lms_batch/lms_batch.js @@ -1,7 +1,7 @@ // Copyright (c) 2022, Frappe and contributors // For license information, please see license.txt -frappe.ui.form.on("LMS Class", { +frappe.ui.form.on("LMS Batch", { onload: function (frm) { frm.set_query("student", "students", function (doc) { return { @@ -15,7 +15,7 @@ frappe.ui.form.on("LMS Class", { fetch_lessons: (frm) => { frm.clear_table("scheduled_flow"); frappe.call({ - method: "lms.lms.doctype.lms_class.lms_class.fetch_lessons", + method: "lms.lms.doctype.lms_batch.lms_batch.fetch_lessons", args: { courses: frm.doc.courses, }, diff --git a/lms/lms/doctype/lms_class/lms_class.json b/lms/lms/doctype/lms_batch/lms_batch.json similarity index 91% rename from lms/lms/doctype/lms_class/lms_class.json rename to lms/lms/doctype/lms_batch/lms_batch.json index 06377f3c..26965356 100644 --- a/lms/lms/doctype/lms_class/lms_class.json +++ b/lms/lms/doctype/lms_batch/lms_batch.json @@ -21,11 +21,11 @@ "seat_count", "section_break_6", "description", - "class_details", + "batch_details", "students", "courses", "section_break_gsac", - "paid_class", + "paid_batch", "column_break_iens", "amount", "currency", @@ -70,13 +70,13 @@ "fieldname": "students", "fieldtype": "Table", "label": "Students", - "options": "Class Student" + "options": "Batch Student" }, { "fieldname": "courses", "fieldtype": "Table", "label": "Courses", - "options": "Class Course" + "options": "Batch Course" }, { "fieldname": "start_date", @@ -86,7 +86,7 @@ "reqd": 1 }, { - "description": "The HTML code entered here will be displayed on the class details page.", + "description": "The HTML code entered here will be displayed on the batch details page.", "fieldname": "custom_component", "fieldtype": "Code", "label": "Custom Component", @@ -94,10 +94,10 @@ }, { "default": "0", - "description": "Students will be enrolled in a paid class once they complete the payment", - "fieldname": "paid_class", + "description": "Students will be enrolled in a paid batch once they complete the payment", + "fieldname": "paid_batch", "fieldtype": "Check", - "label": "Paid Class" + "label": "Paid Batch" }, { "fieldname": "seat_count", @@ -175,22 +175,22 @@ "fieldtype": "Column Break" }, { - "depends_on": "paid_class", + "depends_on": "paid_batch", "fieldname": "amount", "fieldtype": "Currency", "label": "Amount" }, { - "depends_on": "paid_class", + "depends_on": "paid_batch", "fieldname": "currency", "fieldtype": "Link", "label": "Currency", "options": "Currency" }, { - "fieldname": "class_details", + "fieldname": "batch_details", "fieldtype": "Text Editor", - "label": "Class Details", + "label": "Batch Details", "reqd": 1 } ], @@ -199,7 +199,7 @@ "modified": "2023-08-23 17:35:42.750754", "modified_by": "Administrator", "module": "LMS", - "name": "LMS Class", + "name": "LMS Batch", "naming_rule": "Expression (old style)", "owner": "Administrator", "permissions": [ diff --git a/lms/lms/doctype/lms_class/lms_class.py b/lms/lms/doctype/lms_batch/lms_batch.py similarity index 85% rename from lms/lms/doctype/lms_class/lms_class.py rename to lms/lms/doctype/lms_batch/lms_batch.py index d1c520a5..18fe318b 100644 --- a/lms/lms/doctype/lms_class/lms_class.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -11,7 +11,7 @@ from frappe.utils import cint, format_date, format_datetime from lms.lms.utils import get_lessons -class LMSClass(Document): +class LMSBatch(Document): def validate(self): if self.seat_count: self.validate_seats_left() @@ -26,7 +26,7 @@ class LMSClass(Document): duplicates = {student for student in students if students.count(student) > 1} if len(duplicates): frappe.throw( - _("Student {0} has already been added to this class.").format( + _("Student {0} has already been added to this batch.").format( frappe.bold(next(iter(duplicates))) ) ) @@ -37,7 +37,7 @@ class LMSClass(Document): if len(duplicates): title = frappe.db.get_value("LMS Course", next(iter(duplicates)), "title") frappe.throw( - _("Course {0} has already been added to this class.").format(frappe.bold(title)) + _("Course {0} has already been added to this batch.").format(frappe.bold(title)) ) def validate_duplicate_assessments(self): @@ -48,7 +48,7 @@ class LMSClass(Document): assessment.assessment_type, assessment.assessment_name, "title" ) frappe.throw( - _("Assessment {0} has already been added to this class.").format( + _("Assessment {0} has already been added to this batch.").format( frappe.bold(title) ) ) @@ -66,7 +66,7 @@ class LMSClass(Document): def validate_seats_left(self): if cint(self.seat_count) < len(self.students): - frappe.throw(_("There are no seats available in this class.")) + frappe.throw(_("There are no seats available in this batch.")) def validate_schedule(self): for schedule in self.scheduled_flow: @@ -82,32 +82,32 @@ class LMSClass(Document): if schedule.start_time < self.start_time or schedule.start_time > self.end_time: frappe.throw( - _("Row #{0} Start time cannot be outside the class duration.").format( + _("Row #{0} Start time cannot be outside the batch duration.").format( schedule.idx ) ) if schedule.end_time < self.start_time or schedule.end_time > self.end_time: frappe.throw( - _("Row #{0} End time cannot be outside the class duration.").format(schedule.idx) + _("Row #{0} End time cannot be outside the batch duration.").format(schedule.idx) ) if schedule.date < self.start_date or schedule.date > self.end_date: frappe.throw( - _("Row #{0} Date cannot be outside the class duration.").format(schedule.idx) + _("Row #{0} Date cannot be outside the batch duration.").format(schedule.idx) ) @frappe.whitelist() -def remove_student(student, class_name): +def remove_student(student, batch_name): frappe.only_for("Moderator") - frappe.db.delete("Class Student", {"student": student, "parent": class_name}) + frappe.db.delete("Batch Student", {"student": student, "parent": batch_name}) @frappe.whitelist() def remove_course(course, parent): frappe.only_for("Moderator") - frappe.db.delete("Class Course", {"course": course, "parent": parent}) + frappe.db.delete("Batch Course", {"course": course, "parent": parent}) @frappe.whitelist() @@ -118,7 +118,7 @@ def remove_assessment(assessment, parent): @frappe.whitelist() def create_live_class( - class_name, title, duration, date, time, timezone, auto_recording, description=None + batch_name, title, duration, date, time, timezone, auto_recording, description=None ): date = format_date(date, "yyyy-mm-dd", True) frappe.only_for("Moderator") @@ -152,7 +152,7 @@ def create_live_class( "host": frappe.session.user, "date": date, "time": time, - "class_name": class_name, + "batch_name": batch_name, "password": data.get("password"), "description": description, "auto_recording": auto_recording, @@ -186,27 +186,27 @@ def authenticate(): @frappe.whitelist() -def create_class( +def create_batch( title, start_date, end_date, description=None, - class_details=None, + batch_details=None, seat_count=0, start_time=None, end_time=None, medium="Online", category=None, - paid_class=0, + paid_batch=0, amount=0, currency=None, name=None, ): frappe.only_for("Moderator") if name: - doc = frappe.get_doc("LMS Class", name) + doc = frappe.get_doc("LMS Batch", name) else: - doc = frappe.get_doc({"doctype": "LMS Class"}) + doc = frappe.get_doc({"doctype": "LMS Batch"}) doc.update( { @@ -214,13 +214,13 @@ def create_class( "start_date": start_date, "end_date": end_date, "description": description, - "class_details": class_details, + "batch_details": batch_details, "seat_count": seat_count, "start_time": start_time, "end_time": end_time, "medium": medium, "category": category, - "paid_class": paid_class, + "paid_batch": paid_batch, "amount": amount, "currency": currency, } diff --git a/lms/lms/doctype/lms_class/test_lms_class.py b/lms/lms/doctype/lms_batch/test_lms_batch.py similarity index 100% rename from lms/lms/doctype/lms_class/test_lms_class.py rename to lms/lms/doctype/lms_batch/test_lms_batch.py diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.json b/lms/lms/doctype/lms_certificate/lms_certificate.json index 512287bd..263c7034 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.json +++ b/lms/lms/doctype/lms_certificate/lms_certificate.json @@ -11,7 +11,7 @@ "column_break_3", "issue_date", "expiry_date", - "class_name" + "batch_name" ], "fields": [ { @@ -55,16 +55,16 @@ "read_only": 1 }, { - "fieldname": "class_name", + "fieldname": "batch_name", "fieldtype": "Link", "in_standard_filter": 1, - "label": "Class Name", - "options": "LMS Class" + "label": "Batch Name", + "options": "LMS Batch" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-08-23 14:48:49.351394", + "modified": "2023-08-23 14:48:49.351395", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate", diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json index 40753451..eb66ee71 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json @@ -13,7 +13,7 @@ "date", "start_time", "end_time", - "class_name", + "batch_name", "section_break_6", "rating", "status", @@ -97,16 +97,16 @@ "fieldtype": "Column Break" }, { - "fieldname": "class_name", + "fieldname": "batch_name", "fieldtype": "Link", "in_standard_filter": 1, - "label": "Class Name", - "options": "LMS Class" + "label": "Batch Name", + "options": "LMS Batch" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-08-23 14:51:21.947160", + "modified": "2023-08-23 14:51:21.947169", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Evaluation", diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json index 957c9151..e8f35028 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.json @@ -8,7 +8,7 @@ "field_order": [ "course", "evaluator", - "class_name", + "batch_name", "column_break_4", "member", "member_name", @@ -100,16 +100,16 @@ "read_only": 1 }, { - "fieldname": "class_name", + "fieldname": "batch_name", "fieldtype": "Link", "in_standard_filter": 1, - "label": "Class Name", - "options": "LMS Class" + "label": "Batch Name", + "options": "LMS Batch" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-08-23 14:50:37.618350", + "modified": "2023-08-23 14:50:37.618352", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Request", diff --git a/lms/lms/doctype/lms_live_class/lms_live_class.json b/lms/lms/doctype/lms_live_class/lms_live_class.json index 814bc662..1e68dbfc 100644 --- a/lms/lms/doctype/lms_live_class/lms_live_class.json +++ b/lms/lms/doctype/lms_live_class/lms_live_class.json @@ -9,7 +9,7 @@ "field_order": [ "title", "host", - "class_name", + "batch_name", "password", "auto_recording", "column_break_astv", @@ -111,10 +111,10 @@ "reqd": 1 }, { - "fieldname": "class_name", + "fieldname": "batch_name", "fieldtype": "Link", - "label": "Class", - "options": "LMS Class" + "label": "Batch", + "options": "LMS Batch" }, { "default": "No Recording", @@ -126,7 +126,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-03-14 18:44:48.813102", + "modified": "2023-03-14 18:44:48.813103", "modified_by": "Administrator", "module": "LMS", "name": "LMS Live Class", diff --git a/lms/lms/doctype/lms_live_class/lms_live_class.py b/lms/lms/doctype/lms_live_class/lms_live_class.py index 24d239db..872f2a06 100644 --- a/lms/lms/doctype/lms_live_class/lms_live_class.py +++ b/lms/lms/doctype/lms_live_class/lms_live_class.py @@ -34,7 +34,7 @@ class LMSLiveClass(Document): def add_event_participants(self, event, calendar): participants = frappe.get_all( - "Class Student", {"parent": self.class_name}, pluck="student" + "Batch Student", {"parent": self.class_name}, pluck="student" ) participants.append(frappe.session.user) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 1f8bb1c5..892df016 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -800,7 +800,7 @@ def get_evaluator(course, class_name=None): if class_name: evaluator = frappe.db.get_value( - "Class Course", + "Batch Course", {"parent": class_name, "course": course}, "evaluator", ) @@ -869,7 +869,7 @@ def get_details(doctype, docname): frappe.throw(_("This course is free.")) else: details = frappe.db.get_value( - "LMS Class", + "LMS Batch", docname, ["name", "title", "paid_class", "currency", "amount"], as_dict=True, @@ -996,13 +996,13 @@ def create_membership(course, payment): def add_student_to_class(classname, payment): - student = frappe.new_doc("Class Student") + student = frappe.new_doc("Batch Student") student.update( { "student": frappe.session.user, "payment": payment, "parent": classname, - "parenttype": "LMS Class", + "parenttype": "LMS Batch", "parentfield": "students", } ) diff --git a/lms/lms/web_form/evaluation/evaluation.json b/lms/lms/web_form/evaluation/evaluation.json index c2dd3e12..6dbafdae 100644 --- a/lms/lms/web_form/evaluation/evaluation.json +++ b/lms/lms/web_form/evaluation/evaluation.json @@ -22,7 +22,7 @@ "login_required": 1, "max_attachment_size": 0, "meta_image": "/files/og_image_web_form_evaluation_68ddf18e.png", - "modified": "2023-08-23 14:37:03.086303", + "modified": "2023-08-23 14:37:03.086304", "modified_by": "Administrator", "module": "LMS", "name": "evaluation", @@ -63,13 +63,13 @@ }, { "allow_read_on_all_link_options": 0, - "fieldname": "class_name", + "fieldname": "batch_name", "fieldtype": "Link", "hidden": 0, - "label": "Class Name", + "label": "Batch Name", "max_length": 0, "max_value": 0, - "options": "LMS Class", + "options": "LMS Batch", "read_only": 0, "reqd": 0, "show_in_filter": 0 diff --git a/lms/patches.txt b/lms/patches.txt index d2f8efef..7325093e 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -64,4 +64,5 @@ execute:frappe.permissions.reset_perms("LMS Certificate Evaluation") lms.patches.v1_0.paid_certificate_to_paid_course #18-08-2023 lms.patches.v1_0.revert_class_registration #18-08-2023 lms.patches.v1_0.rename_lms_batch_doctype -lms.patches.v1_0.rename_lms_batch_membership_doctype \ No newline at end of file +lms.patches.v1_0.rename_lms_batch_membership_doctype +lms.patches.v1_0.rename_lms_class_to_lms_batch \ No newline at end of file diff --git a/lms/patches/v1_0/rename_lms_class_to_lms_batch.py b/lms/patches/v1_0/rename_lms_class_to_lms_batch.py new file mode 100644 index 00000000..333cde40 --- /dev/null +++ b/lms/patches/v1_0/rename_lms_class_to_lms_batch.py @@ -0,0 +1,32 @@ +import frappe +from frappe.model.rename_doc import rename_doc + + +def execute(): + if frappe.db.exists("DocField", {"fieldname": "students", "parent": "LMS Batch"}): + return + + rename_lms_class() + rename_class_student() + rename_class_courses() + + +def rename_lms_class(): + frappe.flags.ignore_route_conflict_validation = True + rename_doc("DocType", "LMS Class", "LMS Batch") + frappe.flags.ignore_route_conflict_validation = False + frappe.reload_doctype("LMS Batch", force=True) + + +def rename_class_student(): + frappe.flags.ignore_route_conflict_validation = True + rename_doc("DocType", "Class Student", "Batch Student") + frappe.flags.ignore_route_conflict_validation = False + frappe.reload_doctype("Batch Student", force=True) + + +def rename_class_courses(): + frappe.flags.ignore_route_conflict_validation = True + rename_doc("DocType", "Class Course", "Batch Course") + frappe.flags.ignore_route_conflict_validation = False + frappe.reload_doctype("Batch Course", force=True) diff --git a/lms/public/js/common_functions.js b/lms/public/js/common_functions.js index 8a1149b8..9d3be071 100644 --- a/lms/public/js/common_functions.js +++ b/lms/public/js/common_functions.js @@ -37,8 +37,8 @@ frappe.ready(() => { show_no_preview_dialog(e); }); - $("#create-class").click((e) => { - open_class_dialog(e); + $("#create-batch").click((e) => { + open_batch_dialog(e); }); $("#course-filter").change((e) => { @@ -250,37 +250,37 @@ const show_no_preview_dialog = (e) => { $("#no-preview-modal").modal("show"); }; -const open_class_dialog = () => { - this.class_dialog = new frappe.ui.Dialog({ - title: __("New Class"), +const open_batch_dialog = () => { + this.batch_dialog = new frappe.ui.Dialog({ + title: __("New Batch"), fields: [ { fieldtype: "Data", label: __("Title"), fieldname: "title", reqd: 1, - default: class_info && class_info.title, + default: batch_info && batch_info.title, }, { fieldtype: "Date", label: __("Start Date"), fieldname: "start_date", reqd: 1, - default: class_info && class_info.start_date, + default: batch_info && batch_info.start_date, }, { fieldtype: "Date", label: __("End Date"), fieldname: "end_date", reqd: 1, - default: class_info && class_info.end_date, + default: batch_info && batch_info.end_date, }, { fieldtype: "Select", label: __("Medium"), fieldname: "medium", options: ["Online", "Offline"], - default: (class_info && class_info.medium) || "Online", + default: (batch_info && batch_info.medium) || "Online", }, { fieldtype: "Column Break", @@ -289,26 +289,26 @@ const open_class_dialog = () => { fieldtype: "Time", label: __("Start Time"), fieldname: "start_time", - default: class_info && class_info.start_time, + default: batch_info && batch_info.start_time, }, { fieldtype: "Time", label: __("End Time"), fieldname: "end_time", - default: class_info && class_info.end_time, + default: batch_info && batch_info.end_time, }, { fieldtype: "Int", label: __("Seat Count"), fieldname: "seat_count", - default: class_info && class_info.seat_count, + default: batch_info && batch_info.seat_count, }, { fieldtype: "Link", label: __("Category"), fieldname: "category", options: "LMS Category", - default: class_info && class_info.category, + default: batch_info && batch_info.category, }, { fieldtype: "Section Break", @@ -317,14 +317,14 @@ const open_class_dialog = () => { fieldtype: "Small Text", label: __("Description"), fieldname: "description", - default: class_info && class_info.description, + default: batch_info && batch_info.description, reqd: 1, }, { fieldtype: "Text Editor", - label: __("Class Details"), - fieldname: "class_details", - default: class_info && class_info.class_details, + label: __("Batch Details"), + fieldname: "batch_details", + default: batch_info && batch_info.batch_details, reqd: 1, }, { @@ -334,57 +334,57 @@ const open_class_dialog = () => { }, { fieldtype: "Check", - label: __("Paid Class"), - fieldname: "paid_class", - default: class_info && class_info.paid_class, + label: __("Paid Batch"), + fieldname: "paid_batch", + default: batch_info && batch_info.paid_batch, }, { fieldtype: "Currency", label: __("Amount"), fieldname: "amount", - default: class_info && class_info.amount, - mandatory_depends_on: "paid_class", - depends_on: "paid_class", + default: batch_info && batch_info.amount, + mandatory_depends_on: "paid_batch", + depends_on: "paid_batch", }, { fieldtype: "Link", label: __("Currency"), fieldname: "currency", options: "Currency", - default: class_info && class_info.currency, - mandatory_depends_on: "paid_class", - depends_on: "paid_class", + default: batch_info && batch_info.currency, + mandatory_depends_on: "paid_batch", + depends_on: "paid_batch", only_select: 1, }, ], primary_action_label: __("Save"), primary_action: (values) => { - save_class(values); + save_batch(values); }, }); - this.class_dialog.show(); + this.batch_dialog.show(); }; -const save_class = (values) => { +const save_batch = (values) => { let args = {}; - if (class_info) { - args = Object.assign(class_info, values); + if (batch_info) { + args = Object.assign(batch_info, values); } else { args = values; } frappe.call({ - method: "lms.lms.doctype.lms_class.lms_class.create_class", + method: "lms.lms.doctype.lms_batch.lms_batch.create_batch", args: args, callback: (r) => { if (r.message) { frappe.show_alert({ - message: class_info - ? __("Class Updated") - : __("Class Created"), + message: batch_info + ? __("Batch Updated") + : __("Batch Created"), indicator: "green", }); - this.class_dialog.hide(); - window.location.href = `/classes/details/${r.message.name}`; + this.batch_dialog.hide(); + window.location.href = `/batches/details/${r.message.name}`; } }, }); diff --git a/lms/www/batch/learn.py b/lms/www/batch/learn.py index 36244a2f..ebf2eb31 100644 --- a/lms/www/batch/learn.py +++ b/lms/www/batch/learn.py @@ -21,7 +21,7 @@ def get_context(context): context.class_info = frappe._dict( { "name": class_name, - "title": frappe.db.get_value("LMS Class", class_name, "title"), + "title": frappe.db.get_value("LMS Batch", class_name, "title"), } ) diff --git a/lms/www/classes/__init__.py b/lms/www/batches/__init__.py similarity index 100% rename from lms/www/classes/__init__.py rename to lms/www/batches/__init__.py diff --git a/lms/www/classes/class.html b/lms/www/batches/batch.html similarity index 86% rename from lms/www/classes/class.html rename to lms/www/batches/batch.html index 1828fe50..95729d02 100644 --- a/lms/www/classes/class.html +++ b/lms/www/batches/batch.html @@ -1,16 +1,16 @@ {% extends "lms/templates/lms_base.html" %} {% block title %} - {{ _(class_info.title) }} + {{ _(batch_info.title) }} {% endblock %} {% block page_content %}
- {{ BreadCrumb(class_info) }} + {{ BreadCrumb(batch_info) }}
- {{ ClassDetails(class_info) }} - {{ ClassSections(class_info, class_courses, class_students, flow) }} + {{ BatchDetails(batch_info) }} + {{ BatchSections(batch_info, batch_courses, batch_students, flow) }}
@@ -18,26 +18,26 @@ -{% macro BreadCrumb(class_info) %} +{% macro BreadCrumb(batch_info) %} {% endmacro %} - -{% macro ClassDetails(class_info) %} -
+ +{% macro BatchDetails(batch_info) %} +
- {{ class_info.title }} + {{ batch_info.title }}
- {% if class_info.description %} + {% if batch_info.description %}
- {{ class_info.description }} + {{ batch_info.description }}
{% endif %} @@ -47,10 +47,10 @@ - {{ frappe.utils.format_date(class_info.start_date, "long") }} - + {{ frappe.utils.format_date(batch_info.start_date, "long") }} - - {{ frappe.utils.format_date(class_info.end_date, "long") }} + {{ frappe.utils.format_date(batch_info.end_date, "long") }}
@@ -60,7 +60,7 @@ - {{ class_courses | length }} {{ _("Courses") }} + {{ batch_courses | length }} {{ _("Courses") }}
@@ -69,23 +69,22 @@ - {{ class_students | length }} {{ _("Students") }} + {{ batch_students | length }} {{ _("Students") }} - {% if class_info.custom_component %} - {{ class_info.custom_component }} + {% if batch_info.custom_component %} + {{ batch_info.custom_component }} {% endif %} {% endmacro %} - -{% macro ClassSections(class_info, class_courses, class_students, flow) %} +{% macro BatchSections(batch_info, batch_courses, batch_students, flow) %} {% endmacro %} -{% macro Dashboard(class_info, class_courses, current_student) %} +{% macro Dashboard(batch_info, batch_courses, current_student) %} {% set upcoming_evals = current_student.upcoming_evals %} {% set assessments = current_student.assessments %} @@ -218,22 +217,22 @@ {% endmacro %} -{% macro Discussions(class_info) %} +{% macro Discussions(batch_info) %}
{% set condition = is_moderator or is_student or is_evaluator %} - {% set doctype, docname = _("LMS Class"), class_info.name %} + {% set doctype, docname = _("LMS Batch"), batch_info.name %} {% set single_thread = True %} {% set title = "Discussions" %} {% set cta_title = "Post" %} {% set button_name = _("Start Learning") %} - {% set redirect_to = "/classes/" + class_info.name %} + {% set redirect_to = "/batches/" + batch_info.name %} {% set empty_state_title = _("Have a doubt?") %} {% set empty_state_subtitle = _("Post it here, our mentors will help you out.") %} {% include "frappe/templates/discussions/discussions_section.html" %}
{% endmacro %} -{% macro CoursesSection(class_info, class_courses) %} +{% macro CoursesSection(batch_info, batch_courses) %}
@@ -248,9 +247,9 @@
- {% if class_courses | length %} + {% if batch_courses | length %}
- {% for course in class_courses %} + {% for course in batch_courses %}
{{ widgets.CourseCard(course=course, read_only=False) }} {% endif %} - {{ CreateLiveClass(class_info) }} - {{ LiveClassList(class_info, live_classes) }} + {{ CreateLiveClass(batch_info) }} + {{ LiveClassList(batch_info, live_classes) }}
{% endmacro %} -{% macro CreateLiveClass(class_info) %} +{% macro CreateLiveClass(batch_info) %} {% if is_moderator %}