diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index 11450460..3a2a3ac6 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -143,13 +143,14 @@ "default": "0", "fieldname": "is_onboarding_complete", "fieldtype": "Check", - "label": "Is Onboarding Complete" + "label": "Is Onboarding Complete", + "read_only": 1 } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-12-19 18:36:33.987735", + "modified": "2022-12-20 11:44:06.317159", "modified_by": "Administrator", "module": "LMS", "name": "LMS Settings", @@ -170,4 +171,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} +} \ No newline at end of file diff --git a/lms/lms/page/lms_home/lms_home.js b/lms/lms/page/lms_home/lms_home.js index 0ec35174..4521b64d 100644 --- a/lms/lms/page/lms_home/lms_home.js +++ b/lms/lms/page/lms_home/lms_home.js @@ -1,3 +1,3 @@ -frappe.pages['lms-home'].on_page_load = function(wrapper) { - window.location.href = '/courses' -} +frappe.pages["lms-home"].on_page_load = function (wrapper) { + window.location.href = "/courses"; +}; diff --git a/lms/lms/web_template/course_cards/course_cards.html b/lms/lms/web_template/course_cards/course_cards.html index 7d8dc4f1..16aa2b8f 100644 --- a/lms/lms/web_template/course_cards/course_cards.html +++ b/lms/lms/web_template/course_cards/course_cards.html @@ -1,5 +1,4 @@
{{ _(subtitle) }}
diff --git a/lms/patches.txt b/lms/patches.txt index 2f4e6bbc..275ee47a 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -42,3 +42,4 @@ lms.patches.v0_0.quiz_submission_result lms.patches.v0_0.skill_to_user_skill lms.patches.v0_0.rename_instructor_role lms.patches.v0_0.change_course_creation_settings #12-12-2022 +lms.patches.v0_0.check_onboarding_status #21-12-2022 diff --git a/lms/patches/v0_0/check_onboarding_status.py b/lms/patches/v0_0/check_onboarding_status.py new file mode 100644 index 00000000..a57189e0 --- /dev/null +++ b/lms/patches/v0_0/check_onboarding_status.py @@ -0,0 +1,6 @@ +import frappe + +def execute(): + if frappe.db.count("LMS Course") and frappe.db.count("Course Chapter") \ + and frappe.db.count("Course Lesson") and frappe.db.count("LMS Quiz"): + frappe.db.set_value("LMS Settings", None, "is_onboarding_complete", True) diff --git a/lms/templates/lms_base.html b/lms/templates/lms_base.html new file mode 100644 index 00000000..a37775ad --- /dev/null +++ b/lms/templates/lms_base.html @@ -0,0 +1,10 @@ +{% extends "templates/base.html" %} + + +{% block content %} + {% include "public/icons/symbol-defs.svg" %} + {% include "lms/templates/onboarding_header.html" %} + {% block page_content %} + Hello, world! + {% endblock %} +{% endblock %} diff --git a/lms/templates/onboarding_header.html b/lms/templates/onboarding_header.html index fe2fceac..362349c5 100644 --- a/lms/templates/onboarding_header.html +++ b/lms/templates/onboarding_header.html @@ -1,14 +1,13 @@ -{% set is_onboarding_complete = frappe.db.get_single_value("LMS Settings", "is_onboarding_complete") %} - -{% if has_course_moderator_role() and not is_onboarding_complete %} - +{% set onboarding_settings = frappe.db.get_single_value("LMS Settings", "is_onboarding_complete") %} {% set course_created = frappe.db.count("LMS Course") %} -{% set first_course = frappe.db.get_all("LMS Course", order_by="creation", pluck="name")[0] %} {% set chapter_created = frappe.db.count("Course Chapter") %} {% set lesson_created = frappe.db.count("Course Lesson") %} {% set quiz_created = frappe.db.count("LMS Quiz") %} +{% set first_course = frappe.db.get_all("LMS Course", order_by="creation", pluck="name")[0] %} +{% set is_onboarding_complete = onboarding_settings or (course_created and chapter_created and lesson_created and quiz_created) %} +{% if has_course_moderator_role() and not is_onboarding_complete %}