fix: sql query case fix
This commit is contained in:
parent
76fe1b1e9f
commit
d49b5e4736
@ -304,11 +304,11 @@ def get_program_progress(program):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def get_program_completion(program):
|
def get_program_completion(program):
|
||||||
topics = frappe.db.sql("""select `tabcourse topic`.topic, `tabcourse topic`.parent
|
topics = frappe.db.sql("""select `tabCourse Topic`.topic, `tabCourse Topic`.parent
|
||||||
from `tabcourse topic`,
|
from `tabCourse Topic`,
|
||||||
`tabprogram course`
|
`tabProgram Course`
|
||||||
where `tabcourse topic`.parent = `tabprogram course`.course
|
where `tabCourse Topic`.parent = `tabProgram Course`.course
|
||||||
and `tabprogram course`.parent = %s""", program.name)
|
and `tabProgram Course`.parent = %s""", program.name)
|
||||||
|
|
||||||
progress = []
|
progress = []
|
||||||
for topic in topics:
|
for topic in topics:
|
||||||
|
|||||||
@ -34,7 +34,7 @@ def get_context(context):
|
|||||||
context.topic = topic
|
context.topic = topic
|
||||||
|
|
||||||
topic = frappe.get_doc("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
|
# Set context for progress numbers
|
||||||
context.position = content_list.index({'content': content, 'content_type': content_type})
|
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]
|
return content_list[current_index - 1]
|
||||||
|
|
||||||
def allowed_content_access(program, content, content_type):
|
def allowed_content_access(program, content, content_type):
|
||||||
contents_of_program = frappe.db.sql("""select `tabtopic content`.content, `tabtopic content`.content_type
|
contents_of_program = frappe.db.sql("""select `tabTopic Content`.content, `tabTopic Content`.content_type
|
||||||
from `tabcourse topic`,
|
from `tabCourse Topic`,
|
||||||
`tabprogram course`,
|
`tabProgram Course`,
|
||||||
`tabtopic content`
|
`tabTopic Content`
|
||||||
where `tabcourse topic`.parent = `tabprogram course`.course
|
where `tabCourse Topic`.parent = `tabProgram Course`.course
|
||||||
and `tabtopic content`.parent = `tabcourse topic`.topic
|
and `tabTopic Content`.parent = `tabCourse Topic`.topic
|
||||||
and `tabprogram course`.parent = %(program)s""", {'program': program})
|
and `tabProgram Course`.parent = %(program)s""", {'program': program})
|
||||||
|
|
||||||
return (content, content_type) in contents_of_program
|
return (content, content_type) in contents_of_program
|
||||||
Loading…
x
Reference in New Issue
Block a user