]> git.ktnx.net Git - mobile-ledger.git/commitdiff
remove double % when searching transactions by description
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Nov 2021 21:28:21 +0000 (23:28 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Nov 2021 21:28:21 +0000 (23:28 +0200)
it seems to work, but looks strance anyway

app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java

index 001976d3b1ee08393c2ac48d6fbc5d634566a403..c398dbddaae0d1c5315f76cd68ac0429eb5d31c2 100644 (file)
@@ -80,11 +80,11 @@ public abstract class TransactionDAO extends BaseDAO<Transaction> {
     @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<DescriptionContainer> lookupDescriptionSync(@NonNull String term);
 
     @androidx.room.Transaction