]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix ordering of transactions when loaded from database
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 24 Apr 2021 20:53:55 +0000 (23:53 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 25 Apr 2021 17:07:58 +0000 (17:07 +0000)
app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java

index 715d6ea1d72272e9c6ba736697432e8ba4cd3794..e347207cda9ed053b36cb1481d9c62ca2527884c 100644 (file)
@@ -103,11 +103,13 @@ public abstract class TransactionDAO extends BaseDAO<Transaction> {
     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<TransactionWithAccounts> 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<List<TransactionWithAccounts>> getAllWithAccounts(long profileId);
 
     @androidx.room.Transaction