From ea3bde4a30c7f658cfd45a2bf124595cbe8160e7 Mon Sep 17 00:00:00 2001 From: gounux Date: Thu, 14 Mar 2024 07:01:21 +0100 Subject: [PATCH] Fix illogic stuff --- qtribu/gui/dlg_contents.py | 3 ++- qtribu/logic/json_feed.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qtribu/gui/dlg_contents.py b/qtribu/gui/dlg_contents.py index bb1bb83e..9b2a924a 100644 --- a/qtribu/gui/dlg_contents.py +++ b/qtribu/gui/dlg_contents.py @@ -105,8 +105,9 @@ def refresh_list(self, expand_all: bool = False) -> None: def on_search_text_changed(self) -> None: # do nothing if text is too small current = self.search_line_edit.text() - if current != "": + if current == "": self.refresh_list(expand_all=True) + return if len(current) < 3: return self.refresh_list() diff --git a/qtribu/logic/json_feed.py b/qtribu/logic/json_feed.py index fe7e3fc8..338b0038 100644 --- a/qtribu/logic/json_feed.py +++ b/qtribu/logic/json_feed.py @@ -57,6 +57,9 @@ def _map_item(item: Dict[str, Any]) -> RssItem: @staticmethod def _matches(query: str, item: RssItem) -> bool: """Moteur de recherche du turfu""" + words = query.split(" ") + if len(words) > 1: + return all([JsonFeedClient._matches(w, item) for w in words]) return ( query.upper() in item.abstract.upper() or query.upper() in ",".join(item.author).upper()