From c25086757fd78f106939420be5857e00d7d62ac2 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Wed, 27 Feb 2019 10:03:58 +0100 Subject: [PATCH] Add Players --- .../pokeranalytics/android/model/realm/Session.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 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 c6f65f10..83941c8d 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 @@ -347,7 +347,7 @@ open class Session : RealmObject(), SessionInterface, Savable, SessionRow.GAME -> getGameTitle() SessionRow.INITIAL_BUY_IN -> tournamentEntryFee?.toCurrency() ?: "--" SessionRow.LOCATION -> location?.name ?: "--" - SessionRow.PLAYERS -> "TODO" + SessionRow.PLAYERS -> tournamentNumberOfPlayers?.toString() ?: "--" SessionRow.POSITION -> result?.tournamentFinalPosition?.toString() ?: "--" SessionRow.START_DATE -> if (timeFrame != null) timeFrame?.startDate?.shortDateTime() ?: "--" else "--" SessionRow.TABLE_SIZE -> this.tableSize?.let { TableSize(it).localizedTitle(context) } ?: "--" @@ -442,10 +442,9 @@ open class Session : RealmObject(), SessionInterface, Savable, // Add current location and locations list data.add(RowRepresentableEditDescriptor(location, data = LiveData.LOCATION.items(realm))) } - //TODO SessionRow.PLAYERS -> { data.add( - RowRepresentableEditDescriptor("", inputType = InputType.TYPE_CLASS_NUMBER) + RowRepresentableEditDescriptor(tournamentNumberOfPlayers?.toString(), inputType = InputType.TYPE_CLASS_NUMBER) ) } SessionRow.POSITION -> { @@ -456,12 +455,6 @@ open class Session : RealmObject(), SessionInterface, Savable, ) ) } - //TODO - SessionRow.PRIZE -> { - data.add( - RowRepresentableEditDescriptor("", inputType = InputType.TYPE_CLASS_NUMBER) - ) - } SessionRow.TABLE_SIZE -> { data.add(RowRepresentableEditDescriptor(tableSize)) } @@ -548,8 +541,7 @@ 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 -> tournamentNumberOfPlayers = if (value != null) (value as String).toInt() else null 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()