mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 10:21:14 -05:00
fix first paginate method
This commit is contained in:
@@ -217,15 +217,7 @@ def dao_get_paginated_most_recent_inbound_sms_by_user_number_for_service(
|
|||||||
page_size = current_app.config["PAGE_SIZE"]
|
page_size = current_app.config["PAGE_SIZE"]
|
||||||
offset = (page - 1) * page_size
|
offset = (page - 1) * page_size
|
||||||
paginated_results = result[offset : offset + page_size]
|
paginated_results = result[offset : offset + page_size]
|
||||||
serialized_results = []
|
pagination = Pagination(paginated_results, page, page_size, len(result))
|
||||||
for item in paginated_results:
|
|
||||||
serialized_results.append(item.serialize())
|
|
||||||
try:
|
|
||||||
json.dumps(serialized_results)
|
|
||||||
except TypeError as e:
|
|
||||||
current_app.logger.exception("Serialization Error")
|
|
||||||
raise e
|
|
||||||
pagination = Pagination(serialized_results, page, page_size, len(result))
|
|
||||||
return pagination
|
return pagination
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,14 @@ def get_most_recent_inbound_sms_for_service(service_id):
|
|||||||
results = dao_get_paginated_most_recent_inbound_sms_by_user_number_for_service(
|
results = dao_get_paginated_most_recent_inbound_sms_by_user_number_for_service(
|
||||||
service_id, int(page), limit_days
|
service_id, int(page), limit_days
|
||||||
)
|
)
|
||||||
return jsonify(
|
print(f"RESULTS {results}")
|
||||||
data=[row.serialize() for row in results.items], has_next=results.has_next
|
try:
|
||||||
)
|
x = jsonify(
|
||||||
|
data=[row.serialize() for row in results.items], has_next=results.has_next
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
@inbound_sms.route("/summary")
|
@inbound_sms.route("/summary")
|
||||||
|
|||||||
Reference in New Issue
Block a user