chore: Minor code improvements
- Changed variable name in `get_content` function - Added proper exceptions for `get_topic` and `get_content` functions in lms
This commit is contained in:
parent
da2c90cd18
commit
4add826703
@ -32,7 +32,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getContent() {
|
getContent() {
|
||||||
return lms.call('get_content', {
|
return lms.call('get_content', {
|
||||||
type: this.type,
|
content_type: this.type,
|
||||||
content: this.content
|
content: this.content
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
getContent() {
|
getContent() {
|
||||||
return lms.call('get_content', {
|
return lms.call('get_content', {
|
||||||
type: this.type,
|
content_type: this.type,
|
||||||
content: this.content
|
content: this.content
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -291,13 +291,15 @@ def get_course_details(course_name):
|
|||||||
# Functions to get program & course details
|
# Functions to get program & course details
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_topics(course_name):
|
def get_topics(course_name):
|
||||||
|
try:
|
||||||
course = frappe.get_doc('Course', course_name)
|
course = frappe.get_doc('Course', course_name)
|
||||||
topics = course.get_topics()
|
return course.get_topics()
|
||||||
return topics
|
except frappe.DoesNotExistError:
|
||||||
|
frappe.throw(_("Course {0} does not exist.".format(course_name)))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_content(type, content):
|
def get_content(content_type, content):
|
||||||
try:
|
try:
|
||||||
return frappe.get_doc(type, content)
|
return frappe.get_doc(content_type, content)
|
||||||
except:
|
except frappe.DoesNotExistError:
|
||||||
return None
|
frappe.throw(_("{0} {1} does not exist.".format(content_type, content)))
|
Loading…
x
Reference in New Issue
Block a user