|
|
|
|
@ -7,11 +7,12 @@ import io.realm.Realm |
|
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
|
import net.pokeranalytics.android.model.filter.Query |
|
|
|
|
import net.pokeranalytics.android.model.filter.QueryCondition |
|
|
|
|
import net.pokeranalytics.android.model.interfaces.DatedGraphEntry |
|
|
|
|
import net.pokeranalytics.android.model.interfaces.DatedBankrollGraphEntry |
|
|
|
|
import net.pokeranalytics.android.model.realm.Bankroll |
|
|
|
|
import net.pokeranalytics.android.model.realm.Transaction |
|
|
|
|
import net.pokeranalytics.android.ui.graph.DataSetFactory |
|
|
|
|
import net.pokeranalytics.android.util.extensions.findById |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import java.util.* |
|
|
|
|
import kotlin.collections.HashMap |
|
|
|
|
|
|
|
|
|
@ -122,12 +123,12 @@ class BankrollReport(var setup: BankrollReportSetup) { |
|
|
|
|
/** |
|
|
|
|
* The list of dated items used for the graph |
|
|
|
|
*/ |
|
|
|
|
private var evolutionItems: MutableList<DatedGraphEntry> = mutableListOf() |
|
|
|
|
private var evolutionItems: MutableList<DatedBankrollGraphEntry> = mutableListOf() |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds a list of dated items to the evolution items used to get the bankroll graph |
|
|
|
|
*/ |
|
|
|
|
fun addDatedItems(items: Collection<DatedGraphEntry>) { |
|
|
|
|
fun addDatedItems(items: Collection<DatedBankrollGraphEntry>) { |
|
|
|
|
this.evolutionItems.addAll(items) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -167,7 +168,11 @@ class BankrollReport(var setup: BankrollReportSetup) { |
|
|
|
|
|
|
|
|
|
var total = this.initial |
|
|
|
|
this.evolutionItems.forEach { |
|
|
|
|
total += it.amount |
|
|
|
|
val rate = it.bankroll?.rate ?: 1.0 |
|
|
|
|
|
|
|
|
|
Timber.d("rate = $rate, amount = ${it.amount}") |
|
|
|
|
total += it.amount * rate |
|
|
|
|
Timber.d("total = $total") |
|
|
|
|
val point = BRGraphPoint(total, it.date, it.objectIdentifier) |
|
|
|
|
this.evolutionPoints.add(point) |
|
|
|
|
} |
|
|
|
|
|