Fix Buy In and add Prize

feature/top10
Aurelien Hubert 7 years ago
parent 98739449b7
commit fffac5dd15
  1. 12
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt

@ -341,7 +341,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
SessionRow.BLINDS -> getBlinds() SessionRow.BLINDS -> getBlinds()
SessionRow.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: "--" SessionRow.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: "--"
SessionRow.BUY_IN -> buyin.toCurrency() SessionRow.BUY_IN -> buyin.toCurrency()
SessionRow.CASHED_OUT -> result?.cashout?.toCurrency() ?: "--" SessionRow.CASHED_OUT, SessionRow.PRIZE -> result?.cashout?.toCurrency() ?: "--"
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--" SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--"
SessionRow.END_DATE -> if (timeFrame != null) timeFrame?.endDate?.shortDateTime() ?: "--" else "--" SessionRow.END_DATE -> if (timeFrame != null) timeFrame?.endDate?.shortDateTime() ?: "--" else "--"
SessionRow.GAME -> getGameTitle() SessionRow.GAME -> getGameTitle()
@ -349,7 +349,6 @@ open class Session : RealmObject(), SessionInterface, Savable,
SessionRow.LOCATION -> location?.name ?: "--" SessionRow.LOCATION -> location?.name ?: "--"
SessionRow.PLAYERS -> "TODO" SessionRow.PLAYERS -> "TODO"
SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: "--" SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: "--"
SessionRow.PRIZE -> "TODO"
SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: "--" else "--" SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: "--" else "--"
SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: "--" SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: "--"
SessionRow.TIPS -> result?.tips?.toCurrency() ?: "--" SessionRow.TIPS -> result?.tips?.toCurrency() ?: "--"
@ -402,6 +401,9 @@ open class Session : RealmObject(), SessionInterface, Savable,
} else if (tournamentEntryFee != null) { } else if (tournamentEntryFee != null) {
data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 1.0)) data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 1.0))
data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 2.0)) data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 2.0))
} else {
data.add(RowRepresentableEditDescriptor(0))
data.add(RowRepresentableEditDescriptor(0))
} }
data.add(RowRepresentableEditDescriptor(buyin)) data.add(RowRepresentableEditDescriptor(buyin))
@ -418,7 +420,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
) )
) )
} }
SessionRow.CASHED_OUT -> { SessionRow.CASHED_OUT, SessionRow.PRIZE -> {
data.add( data.add(
RowRepresentableEditDescriptor(result?.cashout?.round(), inputType = InputType.TYPE_CLASS_NUMBER) RowRepresentableEditDescriptor(result?.cashout?.round(), inputType = InputType.TYPE_CLASS_NUMBER)
) )
@ -517,7 +519,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
localResult.buyin = value as Double? localResult.buyin = value as Double?
result = localResult result = localResult
} }
SessionRow.CASHED_OUT -> { SessionRow.CASHED_OUT, SessionRow.PRIZE -> {
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) val localResult = if (result != null) result as Result else realm.createObject(Result::class.java)
localResult.cashout = if (value == null) null else (value as String).toDouble() localResult.cashout = if (value == null) null else (value as String).toDouble()
result = localResult result = localResult
@ -553,8 +555,6 @@ open class Session : RealmObject(), SessionInterface, Savable,
localResult.tournamentFinalPosition = if (value == null) null else (value as String).toInt() localResult.tournamentFinalPosition = if (value == null) null else (value as String).toInt()
result = localResult result = localResult
} }
SessionRow.PRIZE -> {
}//TODO
SessionRow.START_DATE -> if (value is Date?) { SessionRow.START_DATE -> if (value is Date?) {
if (value == null) { if (value == null) {
timeFrame = null timeFrame = null

Loading…
Cancel
Save