From: Damyan Ivanov Date: Sat, 24 Apr 2021 20:53:55 +0000 (+0300) Subject: fix ordering of transactions when loaded from database X-Git-Tag: v0.18.0~23 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=bba9ffd8fa7af0e3a940461cbc6448e266794aa6;p=mobile-ledger.git fix ordering of transactions when loaded from database --- 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 715d6ea1..e347207c 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java @@ -103,11 +103,13 @@ public abstract class TransactionDAO extends BaseDAO { protected abstract TransactionGenerationContainer getGenerationPOJOSync(long profileId); @androidx.room.Transaction - @Query("SELECT * FROM transactions WHERE profile_id = :profileId") + @Query("SELECT * FROM transactions WHERE profile_id = :profileId ORDER BY year " + + " desc, month desc, day desc, ledger_id desc") public abstract List getAllWithAccountsSync(long profileId); @androidx.room.Transaction - @Query("SELECT * FROM transactions WHERE profile_id = :profileId") + @Query("SELECT * FROM transactions WHERE profile_id = :profileId ORDER BY year " + + " desc, month desc, day desc, ledger_id desc") public abstract LiveData> getAllWithAccounts(long profileId); @androidx.room.Transaction