From 15952a764c560aa4b1974926773e13facd2e9f12 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 7 Apr 2024 18:49:18 +0200 Subject: [PATCH] Fix for #3021 (speed of calculating number of pages) --- cps/db.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cps/db.py b/cps/db.py index ceb692ec..7028da6b 100644 --- a/cps/db.py +++ b/cps/db.py @@ -839,8 +839,7 @@ class CalibreDB: entries = list() pagination = list() try: - pagination = Pagination(page, pagesize, - len(query.all())) + pagination = Pagination(page, pagesize, query.count()) entries = query.order_by(*order).offset(off).limit(pagesize).all() except Exception as ex: log.error_or_exception(ex)