From 23880ae5670785e463fbb0c98b9a9e8ab0171358 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Wed, 27 Feb 2019 12:09:57 +0530 Subject: [PATCH] fix: Content fetching for articles and videos --- erpnext/public/js/education/lms/components/Article.vue | 5 ++++- erpnext/public/js/education/lms/components/Video.vue | 5 ++++- erpnext/www/lms.py | 9 ++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/education/lms/components/Article.vue b/erpnext/public/js/education/lms/components/Article.vue index 202947e687..4678db27bd 100644 --- a/erpnext/public/js/education/lms/components/Article.vue +++ b/erpnext/public/js/education/lms/components/Article.vue @@ -31,7 +31,10 @@ export default { }, methods: { getContent() { - return frappe.db.get_doc(this.type, this.content) + return lms.call('get_content', { + type: this.type, + content: this.content + }) } }, components: { diff --git a/erpnext/public/js/education/lms/components/Video.vue b/erpnext/public/js/education/lms/components/Video.vue index c86bf1afbe..3cfca05f3d 100644 --- a/erpnext/public/js/education/lms/components/Video.vue +++ b/erpnext/public/js/education/lms/components/Video.vue @@ -50,7 +50,10 @@ export default { }, methods: { getContent() { - return frappe.db.get_doc(this.type, this.content) + return lms.call('get_content', { + type: this.type, + content: this.content + }) } } }; diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py index c2a8bd5947..b91dcc97ab 100644 --- a/erpnext/www/lms.py +++ b/erpnext/www/lms.py @@ -280,4 +280,11 @@ def get_course_details(course_name): def get_topics(course_name): course = frappe.get_doc('Course', course_name) topics = course.get_topics() - return topics \ No newline at end of file + return topics + +@frappe.whitelist() +def get_content(type, content): + try: + return frappe.get_doc(type, content) + except: + return None \ No newline at end of file