|
|
|
@ -462,7 +462,7 @@ open class Session : RealmObject(), Identifiable, Manageable, StaticRowRepresent |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Utility method to cleanly end a session |
|
|
|
* Utility method to cleanly end a session |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun end() { |
|
|
|
fun end() { |
|
|
|
this.pauseDate = null |
|
|
|
this.pauseDate = null |
|
|
|
if (this.endDate == null) { |
|
|
|
if (this.endDate == null) { |
|
|
|
this.endDate = Date() |
|
|
|
this.endDate = Date() |
|
|
|
@ -702,9 +702,12 @@ open class Session : RealmObject(), Identifiable, Manageable, StaticRowRepresent |
|
|
|
"ratedBuyin" to ratedBuyin |
|
|
|
"ratedBuyin" to ratedBuyin |
|
|
|
)) |
|
|
|
)) |
|
|
|
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf()) |
|
|
|
SessionRow.BREAK_TIME -> row.editingDescriptors(mapOf()) |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> row.editingDescriptors(mapOf( |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE -> row.editingDescriptors(mapOf( |
|
|
|
"defaultValue" to result?.cashout?.round() |
|
|
|
"defaultValue" to result?.cashout?.round() |
|
|
|
)) |
|
|
|
)) |
|
|
|
|
|
|
|
SessionRow.NET_RESULT -> row.editingDescriptors(mapOf( |
|
|
|
|
|
|
|
"defaultValue" to result?.netResult?.round() |
|
|
|
|
|
|
|
)) |
|
|
|
SessionRow.COMMENT -> row.editingDescriptors(mapOf( |
|
|
|
SessionRow.COMMENT -> row.editingDescriptors(mapOf( |
|
|
|
"defaultValue" to this.comment)) |
|
|
|
"defaultValue" to this.comment)) |
|
|
|
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf( |
|
|
|
SessionRow.INITIAL_BUY_IN -> row.editingDescriptors(mapOf( |
|
|
|
@ -758,18 +761,22 @@ open class Session : RealmObject(), Identifiable, Manageable, StaticRowRepresent |
|
|
|
this.result = localResult |
|
|
|
this.result = localResult |
|
|
|
this.updateRowRepresentation() |
|
|
|
this.updateRowRepresentation() |
|
|
|
} |
|
|
|
} |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE, SessionRow.NET_RESULT -> { |
|
|
|
SessionRow.CASHED_OUT, SessionRow.PRIZE -> { |
|
|
|
val localResult = if (this.result != null) this.result as Result else realm.createObject(Result::class.java) |
|
|
|
val localResult = if (this.result != null) this.result as Result else realm.createObject(Result::class.java) |
|
|
|
|
|
|
|
|
|
|
|
if (value == null) { |
|
|
|
if (value == null) { |
|
|
|
localResult.cashout = null |
|
|
|
localResult.cashout = null |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
localResult.cashout = (value as String).toDouble() |
|
|
|
localResult.cashout = (value as String).toDouble() |
|
|
|
this.end() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.result = localResult |
|
|
|
this.result = localResult |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.NET_RESULT -> { |
|
|
|
|
|
|
|
this.result?.let { result -> |
|
|
|
|
|
|
|
result.netResult = (value as String).toDouble() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
SessionRow.COMMENT -> comment = value as String? ?: "" |
|
|
|
SessionRow.COMMENT -> comment = value as String? ?: "" |
|
|
|
|
|
|
|
|
|
|
|
SessionRow.END_DATE -> if (value is Date?) { |
|
|
|
SessionRow.END_DATE -> if (value is Date?) { |
|
|
|
|