From d388c4d29cc4891fd05d1b60d56c1bdaad2b5148 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Wed, 10 Jan 2024 00:05:59 +0000 Subject: [PATCH] Limit result_range_max --- app/schemas/api_response.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/schemas/api_response.py b/app/schemas/api_response.py index a880337..dc09534 100644 --- a/app/schemas/api_response.py +++ b/app/schemas/api_response.py @@ -28,7 +28,8 @@ def get_result_range_min(self): return (self.results_per_page * (self.page - 1)) + 1 def get_result_range_max(self): - return self.results_per_page * self.page + page_max = self.results_per_page * self.page + return page_max if page_max <= self.count else self.count def page_in_range(self): return self.page > 0 and self.page <= self.get_pages()