Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix wrong CalcIncomeExpenseAct.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Apr 24, 2022
1 parent a1fb2bd commit 3130270
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.ivy.wallet.domain.pure.exchange.ExchangeData
import com.ivy.wallet.domain.pure.transaction.AccountValueFunctions
import com.ivy.wallet.domain.pure.transaction.foldTransactions
import com.ivy.wallet.domain.pure.util.orZero
import timber.log.Timber
import javax.inject.Inject

class CalcIncomeExpenseAct @Inject constructor(
Expand All @@ -35,6 +36,7 @@ class CalcIncomeExpenseAct @Inject constructor(
)
)
} thenMap { (acc, trns) ->
Timber.i("acc: $acc, trns = ${trns.size}")
Pair(
acc,
foldTransactions(
Expand All @@ -47,6 +49,7 @@ class CalcIncomeExpenseAct @Inject constructor(
)
)
} thenMap { (acc, stats) ->
Timber.i("acc_stats: $acc - $stats")
stats.map {
exchangeAct(
ExchangeAct.Input(
Expand All @@ -60,8 +63,8 @@ class CalcIncomeExpenseAct @Inject constructor(
}
} then { statsList ->
IncomeExpensePair(
income = statsList[0].sumOf { it },
expense = statsList[1].sumOf { it }
income = statsList.sumOf { it[0] },
expense = statsList.sumOf { it[1] }
)
}

Expand Down

0 comments on commit 3130270

Please sign in to comment.