1
0
mirror of https://github.com/ilri/dspace-statistics-api.git synced 2025-05-08 22:26:04 +02:00

Adjust psycopg connection for dict_row factory

This commit is contained in:
2025-04-01 17:42:41 +03:00
parent 8c1a8bde54
commit ce0a2d9213
2 changed files with 5 additions and 6 deletions

View File

@ -81,7 +81,7 @@ class AllStatisticsResource:
with db.cursor() as cursor:
# get total number of communities/collections/items so we can estimate the pages
cursor.execute(f"SELECT COUNT(id) FROM {req.context.statistics_scope}")
pages = math.ceil(cursor.fetchone()[0] / limit)
pages = math.ceil(cursor.fetchone()['count'] / limit)
# get statistics and use limit and offset to page through results
cursor.execute(