From 0de27d6072bea8f0e5cc6347162ffb299d8b82e8 Mon Sep 17 00:00:00 2001 From: Timur Enikeev Date: Sat, 9 Nov 2024 19:44:43 -0500 Subject: [PATCH] subject name fix --- rating_api/models/db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rating_api/models/db.py b/rating_api/models/db.py index 52a7ff2..58e3a5f 100644 --- a/rating_api/models/db.py +++ b/rating_api/models/db.py @@ -49,8 +49,8 @@ def search_by_name(self, query: str) -> bool: def search_by_subject(self, query: str) -> bool: query = query.lower() response = true - if query != "": - response = and_(Comment.review_status == ReviewStatus.APPROVED, func.lower(Comment.subject) == query) + if query: + response = and_(Comment.review_status == ReviewStatus.APPROVED, func.lower(Comment.subject).contains(query)) return response