From 727e803b8b44f1740fc4bf9626ffaefc62c77056 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Thu, 16 Aug 2018 02:50:40 +0200 Subject: [PATCH] Fix balance not being displayed properly for some fee format --- .../herbron/moodl/DataManagers/DatabaseManager.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java b/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java index c85f770..2d073a3 100644 --- a/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java +++ b/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java @@ -544,8 +544,16 @@ public class DatabaseManager extends SQLiteOpenHelper{ while(resultatList.moveToNext()) { - currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)) - , resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)) - resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES)))); + if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)).equals(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_CURRENCY)))) + { + currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)) + , resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)) - resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES)))); + } + else + { + currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)) + , resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT)))); + } } resultatList.close();