refactor: better sql

This commit is contained in:
Shivam Mishra 2019-06-06 11:30:56 +05:30
parent f121b51951
commit 624b4fd5b8
2 changed files with 2 additions and 2 deletions

View File

@ -308,7 +308,7 @@ def get_program_completion(program):
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 = '{0}'""".format(program.name)) and `tabprogram course`.parent = %(program)s""", {'program': program})
progress = [] progress = []
for topic in topics: for topic in topics:

View File

@ -63,6 +63,6 @@ def allowed_content_access(program, content, content_type):
`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 = '{0}'""".format(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