|
|
|
|
@ -66,7 +66,6 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
@ -281,8 +280,6 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
// The number of tables played at the same time |
|
|
|
|
var numberOfTables: Int = 1 |
|
|
|
|
|
|
|
|
|
// var hands: RealmList<HandHistory> = RealmList() |
|
|
|
|
|
|
|
|
|
// The hand histories of the session |
|
|
|
|
@LinkingObjects("session") |
|
|
|
|
val handHistories: RealmResults<HandHistory>? = null |
|
|
|
|
@ -464,7 +461,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
return playerHandsPerHour / tableSize.toDouble() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val hourlyRate: Double |
|
|
|
|
private val hourlyRate: Double |
|
|
|
|
get() { |
|
|
|
|
this.result?.let { result -> |
|
|
|
|
return result.net / this.hourlyDuration |
|
|
|
|
@ -472,7 +469,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
throw ModelException("Session should have an existing Result relationship") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
val bbHourlyRate: BB |
|
|
|
|
private val bbHourlyRate: BB |
|
|
|
|
get() { |
|
|
|
|
return this.bbNet / this.hourlyDuration |
|
|
|
|
} |
|
|
|
|
@ -974,8 +971,6 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
|
|
|
|
|
override fun updateValue(value: Any?, row: RowRepresentable) { |
|
|
|
|
|
|
|
|
|
realm.executeTransaction { |
|
|
|
|
|
|
|
|
|
when (row) { |
|
|
|
|
SessionRow.BANKROLL -> bankroll = value as Bankroll? |
|
|
|
|
SessionRow.BLINDS -> if (value is ArrayList<*>) { |
|
|
|
|
@ -1004,27 +999,19 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
this.breakDuration = (value as Double? ?: 0.0).toLong() * 60 * 1000 |
|
|
|
|
} |
|
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
|
val localResult = |
|
|
|
|
if (this.result != null) this.result as Result else realm.createObject(Result::class.java) |
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
localResult.buyin = value as Double? |
|
|
|
|
this.result = localResult |
|
|
|
|
this.updateRowRepresentation() |
|
|
|
|
} |
|
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE -> { |
|
|
|
|
val localResult = |
|
|
|
|
if (this.result != null) this.result as Result else realm.createObject(Result::class.java) |
|
|
|
|
|
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
localResult.cashout = value as Double? |
|
|
|
|
|
|
|
|
|
this.result = localResult |
|
|
|
|
} |
|
|
|
|
SessionRow.NET_RESULT -> { |
|
|
|
|
this.result?.let { result -> |
|
|
|
|
result.netResult = value as Double? |
|
|
|
|
} |
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
localResult.netResult = value as Double? |
|
|
|
|
} |
|
|
|
|
SessionRow.COMMENT -> comment = value as String? ?: "" |
|
|
|
|
|
|
|
|
|
SessionRow.END_DATE -> if (value is Date?) { |
|
|
|
|
this.endDate = value |
|
|
|
|
} |
|
|
|
|
@ -1072,9 +1059,8 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
} |
|
|
|
|
SessionRow.TABLE_SIZE -> tableSize = value as Int? |
|
|
|
|
SessionRow.TIPS -> { |
|
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
|
val localResult = getOrCreateResult() |
|
|
|
|
localResult.tips = value as Double? |
|
|
|
|
result = localResult |
|
|
|
|
} |
|
|
|
|
SessionRow.TOURNAMENT_NAME -> tournamentName = value as TournamentName? |
|
|
|
|
SessionRow.TOURNAMENT_TYPE -> tournamentType = (value as TournamentType?)?.ordinal |
|
|
|
|
@ -1087,7 +1073,6 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
tournamentFeatures.removeAll(this.tournamentFeatures) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
is CustomField -> { |
|
|
|
|
customFieldEntries.filter { it.customField?.id == row.id }.let { |
|
|
|
|
customFieldEntries.removeAll(it) |
|
|
|
|
@ -1110,8 +1095,16 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun getOrCreateResult(): Result { |
|
|
|
|
return this.result |
|
|
|
|
?: run { |
|
|
|
|
val result = realm.createObject(Result::class.java) |
|
|
|
|
this.result = result |
|
|
|
|
result |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Stat Entry |
|
|
|
|
|