From 9b62e7428cab75fb15b47eaa11928fbf9b98fd46 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 18 Nov 2021 23:28:21 +0200 Subject: [PATCH] remove double % when searching transactions by description it seems to work, but looks strance anyway --- .../java/net/ktnx/mobileledger/dao/TransactionDAO.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.39.2