1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2025-09-17 08:56:42 +02:00

Update string substitution format

Instead of doing numbered strings I will just depend on the order,
at least to be consistent.
This commit is contained in:
2018-09-25 02:19:29 +03:00
parent 2d3b7620e3
commit 4b72f626d9
2 changed files with 4 additions and 4 deletions

4
app.py
View File

@@ -25,7 +25,7 @@ class AllItemsResource:
pages = round(cursor.fetchone()[0] / limit)
# get statistics, ordered by id, and use limit and offset to page through results
cursor.execute('SELECT id, views, downloads FROM items ORDER BY id ASC LIMIT {0} OFFSET {1}'.format(limit, offset))
cursor.execute('SELECT id, views, downloads FROM items ORDER BY id ASC LIMIT {} OFFSET {}'.format(limit, offset))
results = cursor.fetchmany(limit)
cursor.close()
@@ -50,7 +50,7 @@ class ItemResource:
"""Handles GET requests"""
cursor = db.cursor()
cursor.execute('SELECT views, downloads FROM items WHERE id={0}'.format(item_id))
cursor.execute('SELECT views, downloads FROM items WHERE id={}'.format(item_id))
results = cursor.fetchone()
cursor.close()