Commit 19b3195a authored by Johannes Schwab's avatar Johannes Schwab

client: search finds matching ingredients (not just reipce names)

parent 893757e1
...@@ -278,7 +278,7 @@ void SqlBackend::setOneValueIngredients(const QString &valueName, const T &value ...@@ -278,7 +278,7 @@ void SqlBackend::setOneValueIngredients(const QString &valueName, const T &value
QList<Recipe*> SqlBackend::getRecipes(const QString &filter) { QList<Recipe*> SqlBackend::getRecipes(const QString &filter) {
QSqlQuery query = getQuery(); QSqlQuery query = getQuery();
query.prepare("SELECT id FROM recipes WHERE UPPER(name) LIKE UPPER(:filter) ORDER BY name COLLATE NOCASE;"); query.prepare("SELECT DISTINCT r.id FROM recipes r LEFT JOIN ingredients i ON r.id = i.idRecipe WHERE UPPER(r.name) LIKE UPPER(:filter) OR UPPER(i.article) LIKE UPPER(:filter) ORDER BY name COLLATE NOCASE;");
query.bindValue(":filter", QString("%%1%").arg(filter)); query.bindValue(":filter", QString("%%1%").arg(filter));
tryExec(query); tryExec(query);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment