[Major][Breaking] Modified Course Doctype, added Topic based functions
This commit is contained in:
parent
42f50fd82c
commit
1253061055
File diff suppressed because it is too large
Load Diff
@ -25,10 +25,18 @@ class Course(Document):
|
|||||||
content_list = [item for item in contents if item.doctype!="Quiz"]
|
content_list = [item for item in contents if item.doctype!="Quiz"]
|
||||||
return content_list, quiz_list
|
return content_list, quiz_list
|
||||||
|
|
||||||
|
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
|
||||||
|
return topic_data
|
||||||
|
|
||||||
def get_contents(self):
|
def get_contents(self):
|
||||||
try:
|
try:
|
||||||
course_content_list = self.get_all_children()
|
topics = self.get_topics()
|
||||||
content_data = [frappe.get_doc(course_content.content_type, course_content.content) for course_content in course_content_list]
|
content_data = [{'name':topic.name, 'topic_name': topic.topic_name ,'content':topic.get_contents()} for topic in topics]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return None
|
return None
|
||||||
return content_data
|
return content_data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user