From eb7084788395c6f4f0bd44ae188c3f8dd3f73323 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 22 May 2019 16:19:04 -0400 Subject: [PATCH] Fix "Show favorites" button in ModuleBrowser. Change search string format. --- src/app/ModuleBrowser.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/app/ModuleBrowser.cpp b/src/app/ModuleBrowser.cpp index 059db495..51178c9a 100644 --- a/src/app/ModuleBrowser.cpp +++ b/src/app/ModuleBrowser.cpp @@ -33,21 +33,17 @@ namespace app { static float modelScore(plugin::Model *model, const std::string &search) { if (search.empty()) - return true; + return 1.f; std::string s; - s += model->plugin->slug; - s += " "; s += model->plugin->brand; s += " "; - s += model->plugin->name; + s += model->name; s += " "; s += model->slug; - s += " "; - s += model->name; - // for (const std::string &tag : model->tags) { - // s += " "; - // s += tag; - // } + for (const std::string &tag : model->tags) { + s += " "; + s += tag; + } float score = string::fuzzyScore(string::lowercase(s), string::lowercase(search)); return score; } @@ -56,7 +52,7 @@ static bool isModelVisible(plugin::Model *model, bool favorites, const std::stri // Filter favorites if (favorites) { auto it = settings::favoriteModels.find(model); - if (it != settings::favoriteModels.end()) + if (it == settings::favoriteModels.end()) return false; }