Minor fixes
This commit is contained in:
parent
c011b08699
commit
95bb3c0ee9
@ -106,7 +106,6 @@ def evaluate_quiz(enrollment, quiz_response, quiz_name):
|
|||||||
"""LMS Function: Evaluates a simple multiple choice quiz.
|
"""LMS Function: Evaluates a simple multiple choice quiz.
|
||||||
:param quiz_response: contains user selected choices for a quiz in the form of a string formatted as a dictionary. The function uses `json.loads()` to convert it to a python dictionary.
|
:param quiz_response: contains user selected choices for a quiz in the form of a string formatted as a dictionary. The function uses `json.loads()` to convert it to a python dictionary.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
quiz_response = json.loads(quiz_response)
|
quiz_response = json.loads(quiz_response)
|
||||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||||
@ -149,7 +148,7 @@ def enroll_in_program(program_name):
|
|||||||
program_enrollment = student.enroll_in_program(program_name)
|
program_enrollment = student.enroll_in_program(program_name)
|
||||||
return program_name
|
return program_name
|
||||||
|
|
||||||
# Academty Activity
|
# Academty Activity
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def add_activity(course, content_type, content):
|
def add_activity(course, content_type, content):
|
||||||
enrollment = utils.get_course_enrollment(course)
|
enrollment = utils.get_course_enrollment(course)
|
||||||
@ -170,8 +169,8 @@ def add_activity(course, content_type, content):
|
|||||||
def get_course_meta(course_name, program_name):
|
def get_course_meta(course_name, program_name):
|
||||||
"""
|
"""
|
||||||
Return the porgress of a course in a program as well as the content to continue from.
|
Return the porgress of a course in a program as well as the content to continue from.
|
||||||
:param course_name:
|
:param course_name:
|
||||||
:param program_name:
|
:param program_name:
|
||||||
"""
|
"""
|
||||||
course_enrollment = utils.get_course_enrollment(course_name)
|
course_enrollment = utils.get_course_enrollment(course_name)
|
||||||
program_enrollment = utils.get_program_enrollment(program_name)
|
program_enrollment = utils.get_program_enrollment(program_name)
|
||||||
@ -189,7 +188,7 @@ def get_course_meta(course_name, program_name):
|
|||||||
elif count < len(progress):
|
elif count < len(progress):
|
||||||
next_item = next(item for item in progress if item['is_complete']==False)
|
next_item = next(item for item in progress if item['is_complete']==False)
|
||||||
return {'flag':'Continue', 'content_type': next_item['content_type'], 'content': next_item['content']}
|
return {'flag':'Continue', 'content_type': next_item['content_type'], 'content': next_item['content']}
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_program_progress(program_name):
|
def get_program_progress(program_name):
|
||||||
import math
|
import math
|
||||||
@ -238,4 +237,20 @@ def get_quiz_progress(program_name):
|
|||||||
quiz_meta.quiz_attempt = progress_list
|
quiz_meta.quiz_attempt = progress_list
|
||||||
quiz_meta.name = program_name
|
quiz_meta.name = program_name
|
||||||
quiz_meta.program = program.program_name
|
quiz_meta.program = program.program_name
|
||||||
return quiz_meta
|
return quiz_meta
|
||||||
|
|
||||||
|
|
||||||
|
@frappe.whitelist(allow_guest=True)
|
||||||
|
def get_course_details(course_name):
|
||||||
|
try:
|
||||||
|
course = frappe.get_doc('Course', course_name)
|
||||||
|
return course
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Functions to get program & course details
|
||||||
|
@frappe.whitelist(allow_guest=True)
|
||||||
|
def get_topics(course_name):
|
||||||
|
course = frappe.get_doc('Course', course_name)
|
||||||
|
topics = course.get_topics()
|
||||||
|
return topics
|
Loading…
Reference in New Issue
Block a user