mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-12-22 12:42:19 +01: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:
parent
2d3b7620e3
commit
4b72f626d9
4
app.py
4
app.py
@ -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()
|
||||
|
||||
|
@ -55,7 +55,7 @@ def index_views():
|
||||
cursor = db.cursor()
|
||||
|
||||
while results_current_page <= results_num_pages:
|
||||
print('Page {0} of {1}.'.format(results_current_page, results_num_pages))
|
||||
print('Page {} of {}.'.format(results_current_page, results_num_pages))
|
||||
|
||||
res = solr.query('statistics', {
|
||||
'q':'type:2',
|
||||
@ -102,7 +102,7 @@ def index_downloads():
|
||||
cursor = db.cursor()
|
||||
|
||||
while results_current_page <= results_num_pages:
|
||||
print('Page {0} of {1}.'.format(results_current_page, results_num_pages))
|
||||
print('Page {} of {}.'.format(results_current_page, results_num_pages))
|
||||
|
||||
res = solr.query('statistics', {
|
||||
'q':'type:0',
|
||||
|
Loading…
Reference in New Issue
Block a user