chore: Minor code improvements
This commit is contained in:
parent
d2c4af154b
commit
f2d62195b0
@ -20,9 +20,9 @@ class Course(Document):
|
||||
frappe.throw(_("Total Weightage of all Assessment Criteria must be 100%"))
|
||||
|
||||
def get_topics(self):
|
||||
try:
|
||||
topic_list = self.get_all_children()
|
||||
topic_data = [frappe.get_doc("Topic", topic.topic) for topic in topic_list]
|
||||
except frappe.DoesNotExistError:
|
||||
return None
|
||||
topic_data= []
|
||||
for topic in self.topics:
|
||||
topic_doc = frappe.get_doc("Topic", topic.topic)
|
||||
if topic_doc.topic_content:
|
||||
topic_data.append(topic_doc)
|
||||
return topic_data
|
@ -9,6 +9,6 @@ from frappe.model.document import Document
|
||||
class Program(Document):
|
||||
|
||||
def get_course_list(self):
|
||||
program_course_list = self.get_all_children()
|
||||
program_course_list = self.courses
|
||||
course_list = [frappe.get_doc("Course", program_course.course) for program_course in program_course_list]
|
||||
return course_list
|
@ -90,13 +90,14 @@ class Student(Document):
|
||||
"""
|
||||
contents = topic.get_contents()
|
||||
progress = []
|
||||
for content in contents:
|
||||
if content.doctype in ('Article', 'Video'):
|
||||
status = check_content_completion(content.name, content.doctype, course_enrollment_name)
|
||||
progress.append({'content': content.name, 'content_type': content.doctype, 'is_complete': status})
|
||||
elif content.doctype == 'Quiz':
|
||||
status, score, result = check_quiz_completion(content, course_enrollment_name)
|
||||
progress.append({'content': content.name, 'content_type': content.doctype, 'is_complete': status, 'score': score, 'result': result})
|
||||
if contents:
|
||||
for content in contents:
|
||||
if content.doctype in ('Article', 'Video'):
|
||||
status = check_content_completion(content.name, content.doctype, course_enrollment_name)
|
||||
progress.append({'content': content.name, 'content_type': content.doctype, 'is_complete': status})
|
||||
elif content.doctype == 'Quiz':
|
||||
status, score, result = check_quiz_completion(content, course_enrollment_name)
|
||||
progress.append({'content': content.name, 'content_type': content.doctype, 'is_complete': status, 'score': score, 'result': result})
|
||||
return progress
|
||||
|
||||
def enroll_in_program(self, program_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user