From 289240161c4530b589e84a936a04935df1c6069d Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 31 Jan 2025 08:40:19 +0100 Subject: [PATCH] fix: Improve pagination calculation in projects search Uses ceiling division to ensure complete pages are accounted for when returning project results. This prevents loss of data when the total number of projects is not perfectly divisible by the results per page. --- src/structables/utils/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/structables/utils/helpers.py b/src/structables/utils/helpers.py index 6aa0759..27f3c9b 100644 --- a/src/structables/utils/helpers.py +++ b/src/structables/utils/helpers.py @@ -4,6 +4,7 @@ from bs4 import BeautifulSoup import re import logging import json +import math from flask import request, render_template, abort logging.basicConfig(level=logging.DEBUG) @@ -414,7 +415,7 @@ def projects_search( logging.debug(f"Got {len(project_ibles)} projects") - return project_ibles, project_obj["out_of"] + return project_ibles, math.ceil(project_obj["found"] / per_page) def update_data(app):