fix: minor bugs
diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py
index 433ef9f..0e02712 100644
--- a/erpnext/education/utils.py
+++ b/erpnext/education/utils.py
@@ -308,7 +308,7 @@
from `tabcourse topic`,
`tabprogram course`
where `tabcourse topic`.parent = `tabprogram course`.course
- and `tabprogram course`.parent = %(program)s""", {'program': program})
+ and `tabprogram course`.parent = %s""", program.name)
progress = []
for topic in topics:
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
index d2c6da3..0af0778 100644
--- a/erpnext/www/lms/topic.py
+++ b/erpnext/www/lms/topic.py
@@ -17,18 +17,25 @@
def get_contents(topic, course, program):
student = utils.get_current_student()
- if not student:
- return None
- course_enrollment = utils.get_or_create_course_enrollment(course, program)
+ if student:
+ course_enrollment = utils.get_or_create_course_enrollment(course, program)
contents = topic.get_contents()
progress = []
if contents:
for content in contents:
if content.doctype in ('Article', 'Video'):
- status = utils.check_content_completion(content.name, content.doctype, course_enrollment.name)
+ if student:
+ status = utils.check_content_completion(content.name, content.doctype, course_enrollment.name)
+ else:
+ status = True
progress.append({'content': content, 'content_type': content.doctype, 'completed': status})
elif content.doctype == 'Quiz':
- status, score, result = utils.check_quiz_completion(content, course_enrollment.name)
+ if student:
+ status, score, result = utils.check_quiz_completion(content, course_enrollment.name)
+ else:
+ status = False
+ score = None
+ result = None
progress.append({'content': content, 'content_type': content.doctype, 'completed': status, 'score': score, 'result': result})
return progress
\ No newline at end of file