From b31daadf9009fa1a3a2dccdab010cc72d66bd829 Mon Sep 17 00:00:00 2001 From: JeanGarf Date: Fri, 6 Mar 2020 20:52:55 +0100 Subject: [PATCH] #876 - Enhance Code Quality --- .../java/org/gnucash/android/db/adapter/SplitsDbAdapter.java | 5 +++++ app/src/main/java/org/gnucash/android/model/Money.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java b/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java index 3bfb32aca..c74a32c51 100644 --- a/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java +++ b/app/src/main/java/org/gnucash/android/db/adapter/SplitsDbAdapter.java @@ -220,13 +220,18 @@ private Money calculateSplitBalance(List accountUIDList, + " = 0"; if (startTimestamp != -1 && endTimestamp != -1) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " BETWEEN ? AND ? "; selectionArgs = new String[]{String.valueOf(startTimestamp), String.valueOf(endTimestamp)}; + } else if (startTimestamp == -1 && endTimestamp != -1) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " <= ?"; selectionArgs = new String[]{String.valueOf(endTimestamp)}; + } else if (startTimestamp != -1/* && endTimestamp == -1*/) { + selection += " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_TIMESTAMP + " >= ?"; selectionArgs = new String[]{String.valueOf(startTimestamp)}; } diff --git a/app/src/main/java/org/gnucash/android/model/Money.java b/app/src/main/java/org/gnucash/android/model/Money.java index eedc67ac1..0c3ddd145 100644 --- a/app/src/main/java/org/gnucash/android/model/Money.java +++ b/app/src/main/java/org/gnucash/android/model/Money.java @@ -257,7 +257,8 @@ public double asDouble(){ public String asString(){ return toPlainString(); } - + + // TODO TW C 2020-03-06 : A factoriser avec Split.getFormattedAmount /** * Returns a string representation of the Money object formatted according to * the locale and includes the currency symbol.