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 7819002f..5258b44d 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 @@ -313,15 +313,17 @@ open class Session : RealmObject(), SessionInterface, Savable, resId = R.string.hour_rate_without_pauses, value = result?.net.toString() ) ) - rows.add( - HeaderRowRepresentable( - RowViewType.HEADER_TITLE_VALUE, - resId = R.string.bankroll_variation, value = result?.net.toString() + + if (type == TYPE_GAME) { + rows.add( + HeaderRowRepresentable( + RowViewType.HEADER_TITLE_VALUE, + resId = R.string.bankroll_variation, value = result?.net.toString() + ) ) - ) - } - else -> { + } } + else -> {} } // Rows @@ -387,8 +389,14 @@ open class Session : RealmObject(), SessionInterface, Savable, } SessionRow.BUY_IN -> { // Add first & second buttons values, current value & set the 2 edit texts - data.add(RowRepresentableEditDescriptor(100.0 * (cgBigBlind ?: 0.0))) - data.add(RowRepresentableEditDescriptor(200.0 * (cgBigBlind ?: 0.0))) + if (cgBigBlind != null) { + data.add(RowRepresentableEditDescriptor(100.0 * (cgBigBlind ?: 0.0))) + data.add(RowRepresentableEditDescriptor(200.0 * (cgBigBlind ?: 0.0))) + } else if (tournamentEntryFee != null) { + data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 1.0)) + data.add(RowRepresentableEditDescriptor((tournamentEntryFee ?: 0.0) * 2.0)) + } + data.add(RowRepresentableEditDescriptor(buyin)) data.add( RowRepresentableEditDescriptor( @@ -525,13 +533,15 @@ open class Session : RealmObject(), SessionInterface, Savable, } SessionRow.INITIAL_BUY_IN -> tournamentEntryFee = if (value == null) null else (value as String).toDouble() SessionRow.LOCATION -> location = value as Location? - SessionRow.PLAYERS -> ""//TODO + SessionRow.PLAYERS -> { + }//TODO SessionRow.POSITION -> { val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) localResult.tournamentFinalPosition = if (value == null) null else (value as String).toInt() result = localResult } - SessionRow.PRIZE -> ""//TODO + SessionRow.PRIZE -> { + }//TODO SessionRow.START_DATE -> if (value is Date?) { if (value == null) { timeFrame = null diff --git a/app/src/main/java/net/pokeranalytics/android/ui/view/SessionRowView.kt b/app/src/main/java/net/pokeranalytics/android/ui/view/SessionRowView.kt index b753e50a..810250fe 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/view/SessionRowView.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/view/SessionRowView.kt @@ -14,6 +14,7 @@ import net.pokeranalytics.android.model.extensions.getState import net.pokeranalytics.android.model.realm.Session import net.pokeranalytics.android.util.getDayNumber import net.pokeranalytics.android.util.getShortDayName +import net.pokeranalytics.android.util.toCurrency /** * Display a row session @@ -61,14 +62,25 @@ class SessionRowView : FrameLayout { rowHistorySession.dateNumber.text = session.creationDate.getDayNumber() // Title / Game type + var title = "" - if (session.cgSmallBlind != null && session.cgBigBlind != null) { - title += session.getBlinds() - } - session.game?.let { - title += (if (title.isNotEmpty()) " " else "") + session.getGameTitle() + if (session.type == Session.TYPE_TOURNAMENT) { + if (session.tournamentEntryFee != null) { + title += session.tournamentEntryFee?.toCurrency() + } + session.game?.let { + title += (if (title.isNotEmpty()) " " else "") + session.getGameTitle() + } + + } else if (session.type == Session.TYPE_GAME) { + if (session.cgSmallBlind != null && session.cgBigBlind != null) { + title += session.getBlinds() + } + session.game?.let { + title += (if (title.isNotEmpty()) " " else "") + session.getGameTitle() + } + title += if (title.isEmpty()) "--" else "" } - title += if (title.isEmpty()) "--" else "" rowHistorySession.sessionTitle.text = title