mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
fix complaint_dao
This commit is contained in:
@@ -22,7 +22,7 @@ def fetch_paginated_complaints(page=1):
|
|||||||
page_size = current_app.config["PAGE_SIZE"]
|
page_size = current_app.config["PAGE_SIZE"]
|
||||||
total_count = db.session.scalar(select(func.count()).select_from(Complaint))
|
total_count = db.session.scalar(select(func.count()).select_from(Complaint))
|
||||||
offset = (page - 1) * page_size
|
offset = (page - 1) * page_size
|
||||||
stmt = select(Complaint).order_by().offset(offset).limit(page_size)
|
stmt = select(Complaint).order_by(desc(Complaint.created_at)).offset(offset).limit(page_size)
|
||||||
result = db.session.execute(stmt).scalars().all()
|
result = db.session.execute(stmt).scalars().all()
|
||||||
pagination = Pagination(result, page=page, per_page=page_size, total=total_count)
|
pagination = Pagination(result, page=page, per_page=page_size, total=total_count)
|
||||||
return pagination
|
return pagination
|
||||||
|
|||||||
Reference in New Issue
Block a user