]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix converting LedgerTransactionAccount to TransactionAccount (room)
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 25 Apr 2021 16:29:35 +0000 (19:29 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 25 Apr 2021 17:07:58 +0000 (17:07 +0000)
the currency can't be null

having null here led to problems when saving the transaction
speculatively and account amounts are updated, because in the database
account_values.currency is declared not null

app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java

index 53b6a65f3bca893186d73bb0710719fdab8d3fae..774112acef076cd1ad78695da6a0acdcbcde40ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2021 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -129,7 +129,7 @@ public class LedgerTransactionAccount {
         if (amountSet)
             dbo.setAmount(amount);
         dbo.setComment(comment);
-        dbo.setCurrency(currency);
+        dbo.setCurrency(Misc.nullIsEmpty(currency));
         dbo.setId(dbId);
 
         return dbo;