feat: quiz base

This commit is contained in:
Jannat Patel
2023-12-28 11:59:44 +05:30
parent e1d61c9eb9
commit 7087fde686
9 changed files with 334 additions and 41 deletions

View File

@@ -122,7 +122,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-11-07 10:11:49.126789",
"modified": "2023-12-27 12:21:19.289520",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Quiz",
@@ -163,6 +163,15 @@
"role": "Course Creator",
"share": 1,
"write": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS Student",
"share": 1
}
],
"show_title_field_in_link": 1,

View File

@@ -1269,21 +1269,22 @@ def get_course_outline(course):
"""Returns the course outline."""
outline = []
chapters = frappe.get_all(
"Chapter Reference", {"parent": course}, ["chapter"], order_by="idx"
"Chapter Reference", {"parent": course}, ["chapter", "idx"], order_by="idx"
)
for chapter in chapters:
chapter_details = frappe.db.get_value(
"Course Chapter",
chapter.chapter,
["name", "title", "description", "idx"],
["name", "title", "description"],
as_dict=True,
)
chapter_details["idx"] = chapter.idx
chapter_details.lessons = get_lessons(course, chapter_details)
outline.append(chapter_details)
return outline
@frappe.whitelist()
@frappe.whitelist(allow_guest=True)
def get_lesson(course, chapter, lesson):
chapter_name = frappe.db.get_value(
"Chapter Reference", {"parent": course, "idx": chapter}, "chapter"
@@ -1291,6 +1292,16 @@ def get_lesson(course, chapter, lesson):
lesson_name = frappe.db.get_value(
"Lesson Reference", {"parent": chapter_name, "idx": lesson}, "lesson"
)
lesson_details = frappe.db.get_value(
"Course Lesson", lesson_name, ["include_in_preview", "title"], as_dict=1
)
membership = get_membership(course)
if not lesson_details.include_in_preview and not membership:
return {
"no_preview": 1,
"title": lesson_details.title,
}
lesson_details = frappe.db.get_value(
"Course Lesson",
lesson_name,