Skip to content

Commit

Permalink
Issue 1276 - changed the resource access query as f-string (#1281)
Browse files Browse the repository at this point in the history
Co-authored-by: Code Hugger (Matthew Jones) <jonespm@umich.edu>
  • Loading branch information
zqian and jonespm committed Jul 6, 2021
1 parent 10aae86 commit d95ab1d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dashboard/views.py
Expand Up @@ -352,13 +352,13 @@ def resource_access_within_week(request, course_id=0):
output_df.reset_index(inplace=True)

# now insert person's own viewing records: what resources the user has viewed, and the last access timestamp
selfSqlString = "select CONCAT(r.resource_id, ';', r.name) as resource_id_name, count(*) as self_access_count, max(a.access_time) as self_access_last_time " \
"from resource_access a, user u, resource r " \
"where a.user_id = u.user_id " \
"and a.resource_id = r.resource_id " \
"and u.sis_name=%(current_user)s " \
"and a.course_id = %(course_id)s" \
"group by CONCAT(r.resource_id, ';', r.name)"
selfSqlString = f"""select CONCAT(r.resource_id, ';', r.name) as resource_id_name, count(*) as self_access_count, max(a.access_time) as self_access_last_time
from resource_access a, user u, resource r
where a.user_id = u.user_id
and a.resource_id = r.resource_id
and u.sis_name=%(current_user)s
and a.course_id = %(course_id)s
group by CONCAT(r.resource_id, ';', r.name)"""
logger.debug(selfSqlString)
logger.debug("current_user=" + current_user)

Expand Down

0 comments on commit d95ab1d

Please sign in to comment.