[Untested] Fix balance deductions

This commit is contained in:
Tanguy Herbron 2018-08-27 02:48:16 +02:00
parent 2654b044b2
commit 4738a65dcc
2 changed files with 16 additions and 0 deletions

Binary file not shown.

View File

@ -603,6 +603,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
if(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1)
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
, -(resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
* resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
+ resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES)))));
}
break;
case "s":
if(symbol.equals(feeSym))
@ -615,6 +623,14 @@ public class DatabaseManager extends SQLiteOpenHelper{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
, -resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))));
}
if(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1)
{
currencyList.add(new Currency(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
* resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
- resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_FEES))));
}
break;
case "t":
if(isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))) && isBalanceRelated(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))))