From bba9ffd8fa7af0e3a940461cbc6448e266794aa6 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 24 Apr 2021 23:53:55 +0300 Subject: [PATCH] fix ordering of transactions when loaded from database --- .../main/java/net/ktnx/mobileledger/dao/TransactionDAO.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 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 -- 2.39.5