refator: reuse search page component (#2240)

* wip: fix recipe card section

* refactor basic search to share composable

* fix dialog results

* use search for cat/tag/tool pages

* update organizer to support name edits

* fix composable typing
This commit is contained in:
Hayden
2023-03-12 12:59:28 -08:00
committed by GitHub
parent b06517fdf4
commit 9650ba9b00
14 changed files with 205 additions and 538 deletions

View File

@@ -342,6 +342,8 @@ class RepositoryGeneric(Generic[Schema, Model]):
count_query = select(func.count()).select_from(query)
count = self.session.scalar(count_query)
if not count:
count = 0
# interpret -1 as "get_all"
if pagination.per_page == -1:
@@ -349,7 +351,6 @@ class RepositoryGeneric(Generic[Schema, Model]):
try:
total_pages = ceil(count / pagination.per_page)
except ZeroDivisionError:
total_pages = 0