mirror of
https://github.com/frappe/lms.git
synced 2026-05-02 13:39:31 +03:00
fix: dont capture progress of demo course for analytics
This commit is contained in:
@@ -172,7 +172,7 @@ def create_intro_lesson_1(course):
|
||||
title = "What is a Learning Management System?"
|
||||
chapter = get_chapter(course, "Introduction")
|
||||
content = """
|
||||
{"time":1772449622100,"blocks":[{"id":"vYTdcXYVgI","type":"embed","data":{"service":"youtube","source":"http://youtube.com/watch?v=SauviPVDItU","embed":"SauviPVDItU","caption":""}}],"version":"2.29.0"}
|
||||
{"time":1772449622100,"blocks":[{"id":"vYTdcXYVgI","type":"embed","data":{"service":"youtube","source":"https://www.youtube.com/watch?v=-Ulzqjj49lk","embed":"-Ulzqjj49lk","caption":""}}],"version":"2.29.0"}
|
||||
"""
|
||||
create_lesson(course, chapter, title, content)
|
||||
|
||||
@@ -181,7 +181,7 @@ def create_intro_lesson_2(course):
|
||||
title = "What is Frappe Learning?"
|
||||
chapter = get_chapter(course, "Introduction")
|
||||
content = """
|
||||
{"time":1772449622100,"blocks":[{"id":"vYTdcXYVgI","type":"embed","data":{"service":"youtube","source":"http://youtube.com/watch?v=SauviPVDItU","embed":"SauviPVDItU","caption":""}}],"version":"2.29.0"}
|
||||
{"time":1772449622100,"blocks":[{"id":"vYTdcXYVgI","type":"embed","data":{"service":"youtube","source":"https://www.youtube.com/watch?v=VIt_bsbBjLI","embed":"VIt_bsbBjLI","caption":""}}],"version":"2.29.0"}
|
||||
"""
|
||||
create_lesson(course, chapter, title, content)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from frappe.model.document import Document
|
||||
from frappe.realtime import get_website_room
|
||||
from frappe.utils.telemetry import capture
|
||||
|
||||
from lms.lms.utils import get_course_progress, recalculate_course_progress
|
||||
from lms.lms.utils import get_course_progress, is_demo_course, recalculate_course_progress
|
||||
|
||||
from ...md import find_macros
|
||||
|
||||
@@ -127,7 +127,8 @@ def save_progress(lesson: str, course: str, scorm_details: dict = None):
|
||||
)
|
||||
|
||||
progress = get_course_progress(course)
|
||||
capture_progress_for_analytics()
|
||||
if not is_demo_course(course):
|
||||
capture("course_progress", "lms")
|
||||
|
||||
# Had to get doc, as on_change doesn't trigger when you use set_value. The trigger is necessary for badge to get assigned.
|
||||
enrollment = frappe.get_doc("LMS Enrollment", membership)
|
||||
@@ -145,10 +146,6 @@ def save_progress(lesson: str, course: str, scorm_details: dict = None):
|
||||
return progress
|
||||
|
||||
|
||||
def capture_progress_for_analytics():
|
||||
capture("course_progress", "lms")
|
||||
|
||||
|
||||
def get_quiz_progress(lesson):
|
||||
lesson_details = frappe.db.get_value("Course Lesson", lesson, ["body", "content"], as_dict=1)
|
||||
quizzes = []
|
||||
|
||||
@@ -2345,3 +2345,8 @@ def get_field_meta(doctype, fieldnames):
|
||||
}
|
||||
|
||||
return fieldnames_meta
|
||||
|
||||
|
||||
def is_demo_course(course: str) -> bool:
|
||||
title = frappe.db.get_value("LMS Course", course, "title")
|
||||
return title == "A guide to Frappe Learning"
|
||||
|
||||
Reference in New Issue
Block a user