From d49b5e4736d5385afad9cc3c544a8e1ff91f6d2d Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 6 Jun 2019 17:19:53 +0530 Subject: [PATCH] fix: sql query case fix --- erpnext/education/utils.py | 10 +++++----- erpnext/www/lms/content.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py index 0e02712acb..8cd5bbb95b 100644 --- a/erpnext/education/utils.py +++ b/erpnext/education/utils.py @@ -304,11 +304,11 @@ def get_program_progress(program): return None def get_program_completion(program): - topics = frappe.db.sql("""select `tabcourse topic`.topic, `tabcourse topic`.parent - from `tabcourse topic`, - `tabprogram course` - where `tabcourse topic`.parent = `tabprogram course`.course - and `tabprogram course`.parent = %s""", program.name) + topics = frappe.db.sql("""select `tabCourse Topic`.topic, `tabCourse Topic`.parent + from `tabCourse Topic`, + `tabProgram Course` + where `tabCourse Topic`.parent = `tabProgram Course`.course + and `tabProgram Course`.parent = %s""", program.name) progress = [] for topic in topics: diff --git a/erpnext/www/lms/content.py b/erpnext/www/lms/content.py index 3ab7a9f478..0c04845362 100644 --- a/erpnext/www/lms/content.py +++ b/erpnext/www/lms/content.py @@ -34,7 +34,7 @@ def get_context(context): context.topic = topic topic = frappe.get_doc("Topic", topic) - content_list = [{'content_type':item.doctype, 'content':item.name} for item in topic.get_contents()] + content_list = [{'content_type':item.content_type, 'content':item.content} for item in topic.topic_content] # Set context for progress numbers context.position = content_list.index({'content': content, 'content_type': content_type}) @@ -57,12 +57,12 @@ def get_previous_content(content_list, current_index): return content_list[current_index - 1] def allowed_content_access(program, content, content_type): - contents_of_program = frappe.db.sql("""select `tabtopic content`.content, `tabtopic content`.content_type - from `tabcourse topic`, - `tabprogram course`, - `tabtopic content` - where `tabcourse topic`.parent = `tabprogram course`.course - and `tabtopic content`.parent = `tabcourse topic`.topic - and `tabprogram course`.parent = %(program)s""", {'program': program}) + contents_of_program = frappe.db.sql("""select `tabTopic Content`.content, `tabTopic Content`.content_type + from `tabCourse Topic`, + `tabProgram Course`, + `tabTopic Content` + where `tabCourse Topic`.parent = `tabProgram Course`.course + and `tabTopic Content`.parent = `tabCourse Topic`.topic + and `tabProgram Course`.parent = %(program)s""", {'program': program}) return (content, content_type) in contents_of_program \ No newline at end of file