diff --git a/lms/lms/doctype/lesson_assignment/__init__.py b/lms/lms/doctype/lms_assignment_submission/__init__.py similarity index 100% rename from lms/lms/doctype/lesson_assignment/__init__.py rename to lms/lms/doctype/lms_assignment_submission/__init__.py diff --git a/lms/lms/doctype/lesson_assignment/lesson_assignment.js b/lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.js similarity index 100% rename from lms/lms/doctype/lesson_assignment/lesson_assignment.js rename to lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.js diff --git a/lms/lms/doctype/lesson_assignment/lesson_assignment.json b/lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.json similarity index 100% rename from lms/lms/doctype/lesson_assignment/lesson_assignment.json rename to lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.json diff --git a/lms/lms/doctype/lesson_assignment/lesson_assignment.py b/lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.py similarity index 100% rename from lms/lms/doctype/lesson_assignment/lesson_assignment.py rename to lms/lms/doctype/lms_assignment_submission/lms_assignment_submission.py diff --git a/lms/lms/doctype/lesson_assignment/test_lesson_assignment.py b/lms/lms/doctype/lms_assignment_submission/test_lms_assignment_submission.py similarity index 100% rename from lms/lms/doctype/lesson_assignment/test_lesson_assignment.py rename to lms/lms/doctype/lms_assignment_submission/test_lms_assignment_submission.py diff --git a/lms/patches.txt b/lms/patches.txt index dcd27ed3..2f455e83 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -54,3 +54,4 @@ lms.patches.v0_0.share_certificates execute:frappe.delete_doc("Web Form", "class", ignore_missing=True, force=True) lms.patches.v0_0.amend_course_and_lesson_editor_fields lms.patches.v0_0.convert_course_description_to_html #11-05-2023 +lms.patches.v1_0.rename_assignment_doctype \ No newline at end of file diff --git a/lms/patches/v1_0/rename_assignment_doctype.py b/lms/patches/v1_0/rename_assignment_doctype.py new file mode 100644 index 00000000..a0c164e4 --- /dev/null +++ b/lms/patches/v1_0/rename_assignment_doctype.py @@ -0,0 +1,13 @@ +import frappe +from frappe.model.rename_doc import rename_doc + + +def execute(): + if frappe.db.exists("DocType", "LMS Assignment Submission"): + return + + frappe.flags.ignore_route_conflict_validation = True + rename_doc("DocType", "Lesson Assignment", "LMS Assignment Submission") + frappe.flags.ignore_route_conflict_validation = False + + frappe.reload_doctype("LMS Assignment Submission", force=True) diff --git a/lms/www/batch/quiz.py b/lms/www/batch/quiz.py index 5d687fea..2e8bfb9e 100644 --- a/lms/www/batch/quiz.py +++ b/lms/www/batch/quiz.py @@ -1,9 +1,19 @@ import frappe from frappe.utils import cstr +from frappe import _ +from lms.lms.utils import can_create_courses def get_context(context): context.no_cache = 1 + + if not can_create_courses(): + message = "You do not have permission to access this page." + if frappe.session.user == "Guest": + message = "Please login to access this page." + + raise frappe.PermissionError(_(message)) + quizname = frappe.form_dict["quizname"] if quizname == "new-quiz": context.quiz = frappe._dict() diff --git a/lms/www/batch/quiz_list.html b/lms/www/batch/quiz_list.html index 77898384..c53881bd 100644 --- a/lms/www/batch/quiz_list.html +++ b/lms/www/batch/quiz_list.html @@ -35,11 +35,16 @@