From: Damyan Ivanov Date: Thu, 18 Nov 2021 21:28:21 +0000 (+0200) Subject: remove double % when searching transactions by description X-Git-Tag: v0.20.4~4 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=9b62e7428cab75fb15b47eaa11928fbf9b98fd46;p=mobile-ledger.git remove double % when searching transactions by description it seems to work, but looks strance anyway --- diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java index 001976d3..c398dbdd 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java @@ -80,11 +80,11 @@ public abstract class TransactionDAO extends BaseDAO { @Query("SELECT * FROM transactions WHERE id = :transactionId") public abstract TransactionWithAccounts getByIdWithAccountsSync(long transactionId); - @Query("SELECT DISTINCT description, CASE WHEN description_uc LIKE :term||'%%' THEN 1 " + - " WHEN description_uc LIKE '%%:'||:term||'%%' THEN 2 " + - " WHEN description_uc LIKE '%% '||:term||'%%' THEN 3 " + + @Query("SELECT DISTINCT description, CASE WHEN description_uc LIKE :term||'%' THEN 1 " + + " WHEN description_uc LIKE '%:'||:term||'%' THEN 2 " + + " WHEN description_uc LIKE '% '||:term||'%' THEN 3 " + " ELSE 9 END AS ordering FROM transactions " + - "WHERE description_uc LIKE '%%'||:term||'%%' ORDER BY ordering, description_uc, rowid ") + "WHERE description_uc LIKE '%'||:term||'%' ORDER BY ordering, description_uc, rowid ") public abstract List lookupDescriptionSync(@NonNull String term); @androidx.room.Transaction