From 235c5d6b4a361ad0c3eb5381b32255038c5d26a7 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Mon, 31 Mar 2025 09:45:50 +0200 Subject: [PATCH] fixed tests, cleanup, frontend fix --- cookbook/helper/recipe_search.py | 6 +++--- .../tests/other/docs/reports/tests/pytest.xml | 2 +- .../tests/other/docs/reports/tests/tests.html | 8 ++++---- .../tests/other/test_recipe_full_text_search.py | 15 ++++++++------- cookbook/views/api.py | 1 + vue3/src/pages/SearchPage.vue | 5 +++-- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/cookbook/helper/recipe_search.py b/cookbook/helper/recipe_search.py index 081f3fb1c..09daad1bc 100644 --- a/cookbook/helper/recipe_search.py +++ b/cookbook/helper/recipe_search.py @@ -82,7 +82,7 @@ class RecipeSearch(): self._num_recent = int(self._params.get('num_recent', 0)) self._include_children = str2bool( self._params.get('include_children', None)) - self._timescooked = self._params.get('timescooked_gte', None) + self._timescooked = self._params.get('timescooked', None) self._timescooked_gte = self._params.get('timescooked_gte', None) self._timescooked_lte = self._params.get('timescooked_lte', None) @@ -321,7 +321,7 @@ class RecipeSearch(): self._queryset = self._queryset.annotate(recent=Coalesce(Max(Case(When(pk__in=num_recent_recipes.values('recipe'), then='viewlog__pk'))), Value(0))) def _favorite_recipes(self): - if self._sort_includes('favorite') or self._timescooked_gte or self._timescooked_lte: + if self._sort_includes('favorite') or self._timescooked or self._timescooked_gte or self._timescooked_lte: less_than = self._timescooked_lte and not self._sort_includes('-favorite') if less_than: default = 1000 @@ -335,7 +335,7 @@ class RecipeSearch(): ) self._queryset = self._queryset.annotate(favorite=Coalesce(Subquery(favorite_recipes), default)) - if (self._timescooked_lte == 0 and self._timescooked_gte is None) or (self._timescooked_gte == 0 and self._timescooked_lte is None): + if self._timescooked: self._queryset = self._queryset.filter(favorite=0) elif self._timescooked_lte: self._queryset = self._queryset.filter(favorite__lte=int(self._timescooked_lte)).exclude(favorite=0) diff --git a/cookbook/tests/other/docs/reports/tests/pytest.xml b/cookbook/tests/other/docs/reports/tests/pytest.xml index de1721f92..e75cbd73e 100644 --- a/cookbook/tests/other/docs/reports/tests/pytest.xml +++ b/cookbook/tests/other/docs/reports/tests/pytest.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/cookbook/tests/other/docs/reports/tests/tests.html b/cookbook/tests/other/docs/reports/tests/tests.html index 6fbff23e4..9d06d9af3 100644 --- a/cookbook/tests/other/docs/reports/tests/tests.html +++ b/cookbook/tests/other/docs/reports/tests/tests.html @@ -7,7 +7,7 @@

tests.html

-

Report generated on 20-Aug-2024 at 11:35:26 by pytest-html +

Report generated on 31-Mar-2025 at 09:45:35 by pytest-html v4.1.1

Environment

@@ -61,7 +61,7 @@

Summary

-

1 test took 00:00:22.

+

2 tests took 00:00:59.

(Un)check the boxes to filter the results.