From c2e9ef59d675a6c4ace7a3d0e92accc5d5e9bf09 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Wed, 7 Jun 2023 15:43:44 +0530 Subject: [PATCH] fix: onboarding conditions --- lms/lms/utils.py | 6 ++++-- lms/templates/onboarding_header.html | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 29a6bbd8..522084fe 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -722,12 +722,14 @@ def is_onboarding_complete(): lesson_created = frappe.db.a_row_exists("Course Lesson") if course_created and chapter_created and lesson_created: - frappe.db.set_value("LMS Settings", "is_onboarding_complete", 1) + frappe.db.set_single_value("LMS Settings", "is_onboarding_complete", 1) return { "is_onboarded": frappe.db.get_single_value("LMS Settings", "is_onboarding_complete"), "course_created": course_created, "chapter_created": chapter_created, "lesson_created": lesson_created, - "first_course": frappe.get_all("LMS Course", limit=1, order_by=None, pluck="name"), + "first_course": frappe.get_all("LMS Course", limit=1, order_by=None, pluck="name")[0] + if course_created + else None, } diff --git a/lms/templates/onboarding_header.html b/lms/templates/onboarding_header.html index 2461e3f8..204e36ee 100644 --- a/lms/templates/onboarding_header.html +++ b/lms/templates/onboarding_header.html @@ -1,5 +1,5 @@ {% set onboarding_status = is_onboarding_complete() %} -{{ onboarding_status.is_onboarded }} + {% if has_course_moderator_role() and not onboarding_status.is_onboarded %}