From a7e674262debd14e3426a2edc4189e63110961ad Mon Sep 17 00:00:00 2001 From: jankun4 Date: Thu, 28 Mar 2024 00:56:09 +0100 Subject: [PATCH] [#582] make proposal/list search case insensitive Signed-off-by: jankun4 --- CHANGELOG.md | 1 + govtool/backend/src/VVA/API.hs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d732296c7..ec7a3913b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ changes. ### Fixed +- proposal/list search is case insensitive now [Issue 582](https://github.com/IntersectMBO/govtool/issues/582) - proposal/list now takes optional `search` query param [Issue 566](https://github.com/IntersectMBO/govtool/issues/566) - Fix possible sql error when there would be no predefined drep voting pwoer [Issue 501](https://github.com/IntersectMBO/govtool/issues/501) - Fix drep type detection when changing metadata [Issue 333](https://github.com/IntersectMBO/govtool/issues/333) diff --git a/govtool/backend/src/VVA/API.hs b/govtool/backend/src/VVA/API.hs index c215e0486..6072be08f 100644 --- a/govtool/backend/src/VVA/API.hs +++ b/govtool/backend/src/VVA/API.hs @@ -244,13 +244,13 @@ listProposals selectedTypes sortMode mPage mPageSize mDrepRaw mSearchQuery = do - let filterF ProposalResponse{..} = case mSearchQuery of + let filterF ProposalResponse{..} = case Text.toLower <$> mSearchQuery of Nothing -> True Just searchQuery -> fromMaybe False $ do - title <- proposalResponseTitle - about <- proposalResponseAbout - motivation <- proposalResponseMotivation - rationale <- proposalResponseRationale + title <- Text.toLower <$> proposalResponseTitle + about <- Text.toLower <$> proposalResponseAbout + motivation <- Text.toLower <$> proposalResponseMotivation + rationale <- Text.toLower <$> proposalResponseRationale let result = searchQuery `isInfixOf` title || searchQuery `isInfixOf` about