From fffac5dd1521ca2022ead3c16424a76d48a74db0 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Wed, 27 Feb 2019 09:55:06 +0100 Subject: [PATCH] Fix Buy In and add Prize --- .../pokeranalytics/android/model/realm/Session.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt index f28bf231..c6f65f10 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt +++ b/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.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: "--" 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.END_DATE -> if (timeFrame != null) timeFrame?.endDate?.shortDateTime() ?: "--" else "--" SessionRow.GAME -> getGameTitle() @@ -349,7 +349,6 @@ open class Session : RealmObject(), SessionInterface, Savable, SessionRow.LOCATION -> location?.name ?: "--" SessionRow.PLAYERS -> "TODO" SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: "--" - SessionRow.PRIZE -> "TODO" SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: "--" else "--" SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: "--" SessionRow.TIPS -> result?.tips?.toCurrency() ?: "--" @@ -402,6 +401,9 @@ open class Session : RealmObject(), SessionInterface, Savable, } else if (tournamentEntryFee != null) { data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 1.0)) data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 2.0)) + } else { + data.add(RowRepresentableEditDescriptor(0)) + data.add(RowRepresentableEditDescriptor(0)) } data.add(RowRepresentableEditDescriptor(buyin)) @@ -418,7 +420,7 @@ open class Session : RealmObject(), SessionInterface, Savable, ) ) } - SessionRow.CASHED_OUT -> { + SessionRow.CASHED_OUT, SessionRow.PRIZE -> { data.add( RowRepresentableEditDescriptor(result?.cashout?.round(), inputType = InputType.TYPE_CLASS_NUMBER) ) @@ -517,7 +519,7 @@ open class Session : RealmObject(), SessionInterface, Savable, localResult.buyin = value as Double? result = localResult } - SessionRow.CASHED_OUT -> { + SessionRow.CASHED_OUT, SessionRow.PRIZE -> { 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() result = localResult @@ -553,8 +555,6 @@ open class Session : RealmObject(), SessionInterface, Savable, localResult.tournamentFinalPosition = if (value == null) null else (value as String).toInt() result = localResult } - SessionRow.PRIZE -> { - }//TODO SessionRow.START_DATE -> if (value is Date?) { if (value == null) { timeFrame = null