|
|
|
|
@ -676,42 +676,9 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun getFormattedStakes(): String { |
|
|
|
|
|
|
|
|
|
return this.cgStakes?.let { StakesHolder.readableStakes(it) } ?: run { NULL_TEXT } |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
// val formattedBlinds = StakesHolder.formattedBlinds(this.cgBlinds, this.currency) |
|
|
|
|
// val formattedAntes = StakesHolder.formattedAnte(this.cgAnte, this.currency) |
|
|
|
|
// |
|
|
|
|
// return StakesHolder.formattedStakes(formattedBlinds, formattedAntes) |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// val components = arrayListOf<String>() |
|
|
|
|
// this.formattedBlinds?.let { components.add(it) } |
|
|
|
|
// this.formattedAnte?.let { components.add("($it)") } |
|
|
|
|
// |
|
|
|
|
// return if (components.isNotEmpty()) { |
|
|
|
|
// components.joinToString(" ") |
|
|
|
|
// } else { |
|
|
|
|
// NULL_TEXT |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// fun formatBlinds() { |
|
|
|
|
// blinds = null |
|
|
|
|
// if (cgBigBlind == null) return |
|
|
|
|
// cgBigBlind?.let { bb -> |
|
|
|
|
// val sb = cgSmallBlind ?: bb / 2.0 |
|
|
|
|
// val preFormattedBlinds = "${sb.formatted}/${bb.round()}" |
|
|
|
|
// println("<<<<<< bb.toCurrency(currency) : ${bb.toCurrency(currency)}") |
|
|
|
|
// println("<<<<<< preFormattedBlinds : $preFormattedBlinds") |
|
|
|
|
// val regex = Regex("-?\\d+(\\.\\d+)?") |
|
|
|
|
// blinds = bb.toCurrency(currency).replace(regex, preFormattedBlinds) |
|
|
|
|
// println("<<<<<< blinds = $blinds") |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// LifeCycle |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -776,32 +743,12 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim |
|
|
|
|
when (row) { |
|
|
|
|
SessionPropertiesRow.BANKROLL -> bankroll = value as Bankroll? |
|
|
|
|
SessionPropertiesRow.STAKES -> if (value is Stakes) { |
|
|
|
|
|
|
|
|
|
if (value.ante != null) { |
|
|
|
|
this.cgAnte = value.ante |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (value.blinds != null) { |
|
|
|
|
this.cgBlinds = value.blinds |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// cgSmallBlind = try { |
|
|
|
|
// (value[0] as String? ?: "0").toDouble() |
|
|
|
|
// } catch (e: Exception) { |
|
|
|
|
// null |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// cgBigBlind = try { |
|
|
|
|
// (value[1] as String? ?: "0").toDouble() |
|
|
|
|
// } catch (e: Exception) { |
|
|
|
|
// null |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// cgBigBlind?.let { |
|
|
|
|
// if (cgSmallBlind == null || cgSmallBlind == 0.0) { |
|
|
|
|
// cgSmallBlind = it / 2.0 |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
} else if (value == null) { |
|
|
|
|
this.cgBlinds = null |
|
|
|
|
this.cgAnte = null |
|
|
|
|
@ -812,7 +759,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim |
|
|
|
|
SessionPropertiesRow.BUY_IN -> { |
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
localResult.buyin = value as Double? |
|
|
|
|
// this.updateRowRepresentation() |
|
|
|
|
} |
|
|
|
|
SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE -> { |
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
@ -951,7 +897,7 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim |
|
|
|
|
this.bbNet, |
|
|
|
|
this.estimatedHands |
|
|
|
|
) |
|
|
|
|
Stat.AVERAGE_NET_BB -> this.bbNet |
|
|
|
|
Stat.AVERAGE_NET_BB, Stat.BB_NET_RESULT -> this.bbNet |
|
|
|
|
Stat.HOURLY_DURATION, Stat.AVERAGE_HOURLY_DURATION -> this.netDuration.toDouble() |
|
|
|
|
Stat.HOURLY_RATE, Stat.STANDARD_DEVIATION_HOURLY -> this.hourlyRate |
|
|
|
|
Stat.HANDS_PLAYED -> this.estimatedHands |
|
|
|
|
@ -1086,33 +1032,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim |
|
|
|
|
this.result?.netResult = null |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Stakes |
|
|
|
|
|
|
|
|
|
// fun generateStakes() { |
|
|
|
|
// |
|
|
|
|
// if (this.cgAnte == null && this.cgAnte == null) { |
|
|
|
|
// this.cgStakes = null |
|
|
|
|
// return |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// val components = arrayListOf<String>() |
|
|
|
|
// |
|
|
|
|
// this.cgBlinds?.let { components.add("${cbBlinds}${it}") } |
|
|
|
|
// this.cgAnte?.let { components.add("${cbAnte}${it.formatted}") } |
|
|
|
|
// |
|
|
|
|
// val code = this.bankroll?.currency?.code ?: UserDefaults.currency.currencyCode |
|
|
|
|
// components.add("${cbCode}${code}") |
|
|
|
|
// |
|
|
|
|
// this.cgStakes = components.joinToString(cbSeparator) |
|
|
|
|
// } |
|
|
|
|
// |
|
|
|
|
// fun defineHighestBet() { |
|
|
|
|
// val bets = arrayListOf<Double>() |
|
|
|
|
// this.cgAnte?.let { bets.add(it) } |
|
|
|
|
// bets.addAll(this.blindValues) |
|
|
|
|
// this.cgBiggestBet = bets.maxOrNull() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
private fun cleanupBlinds(blinds: String?): String? { |
|
|
|
|
|
|
|
|
|
if (blinds == null) { |
|
|
|
|
|