blob: 027610246230b9b69d318427798699c9038a4aba [file] [log] [blame]
scmmishra6660a672018-10-08 17:18:11 +05301from __future__ import unicode_literals
2import frappe
3
4
5def get_context(context):
scmmishra38c1baf2018-10-12 15:22:16 +05306 if frappe.form_dict['course']:
7 context.current_course = frappe.get_doc("Course", frappe.form_dict["course"])
8 context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
9 context.current_program = frappe.form_dict["program"]
10 context.next_content = get_next_content(context)
11
12
13def get_next_content(context):
14 if context.current_course:
15 course_data = [content_item.content for content_item in context.current_course.course_content]
16 try:
17 return course_data[course_data.index(context.current_content.name) + 1]
18 except IndexError:
19 return None