mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 22:42:28 -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"]
|
||||
total_count = db.session.scalar(select(func.count()).select_from(Complaint))
|
||||
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()
|
||||
pagination = Pagination(result, page=page, per_page=page_size, total=total_count)
|
||||
return pagination
|
||||
|
||||
Reference in New Issue
Block a user