]> git.ktnx.net Git - mobile-ledger.git/commitdiff
AccountRow.equalContents: compare positions too
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 8 Feb 2021 05:49:56 +0000 (05:49 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 18 Feb 2021 07:34:34 +0000 (07:34 +0000)
app/src/main/java/net/ktnx/mobileledger/model/TemplateDetailsItem.java

index d0a6e240f27472e3196fb524819362628103d9eb..f158f413196dace141b2f9f6cdb6f1e9cb1d92fe 100644 (file)
@@ -32,11 +32,13 @@ import net.ktnx.mobileledger.R;
 import net.ktnx.mobileledger.db.TemplateAccount;
 import net.ktnx.mobileledger.db.TemplateBase;
 import net.ktnx.mobileledger.db.TemplateHeader;
 import net.ktnx.mobileledger.db.TemplateAccount;
 import net.ktnx.mobileledger.db.TemplateBase;
 import net.ktnx.mobileledger.db.TemplateHeader;
+import net.ktnx.mobileledger.utils.Logger;
 import net.ktnx.mobileledger.utils.Misc;
 
 import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
 
 import net.ktnx.mobileledger.utils.Misc;
 
 import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.Locale;
 import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.Objects;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -376,8 +378,15 @@ abstract public class TemplateDetailsItem {
             return accountComment.hasLiteralValue();
         }
         public boolean equalContents(AccountRow o) {
             return accountComment.hasLiteralValue();
         }
         public boolean equalContents(AccountRow o) {
+            if (position != o.position) {
+                Logger.debug("cmpAcc",
+                        String.format(Locale.US, "[%d] != [%d]: pos %d != pos %d", getId(),
+                                o.getId(), position, o.position));
+                return false;
+            }
             return amount.equals(o.amount) && accountName.equals(o.accountName) &&
             return amount.equals(o.amount) && accountName.equals(o.accountName) &&
-                   accountComment.equals(o.accountComment) && negateAmount == o.negateAmount;
+                   position == o.position && accountComment.equals(o.accountComment) &&
+                   negateAmount == o.negateAmount;
         }
         public void switchToLiteralAmount() {
             amount.switchToLiteral();
         }
         public void switchToLiteralAmount() {
             amount.switchToLiteral();