perftest
Laurent 3 years ago
parent 3d8991baab
commit 676bd0c94e
  1. 25
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/session/SessionFragment.kt
  3. 10
      app/src/main/java/net/pokeranalytics/android/util/extensions/RealmExtensions.kt

@ -37,7 +37,6 @@ import net.pokeranalytics.android.util.extensions.hourMinute
import net.pokeranalytics.android.util.extensions.shortDateTime
import net.pokeranalytics.android.util.extensions.toCurrency
import net.pokeranalytics.android.util.extensions.toMinutes
import timber.log.Timber
import java.text.DateFormat
import java.text.NumberFormat
import java.text.ParseException
@ -216,7 +215,7 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
this.updateTimeParameter(field)
this.computeNetDuration()
// nullifies enddate when setting the start date after the end date
// nullifies the endDate when setting the start date after the end date
if (value != null && this.endDate != null && value.after(this.endDate)) {
this.endDate = null
}
@ -264,10 +263,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
* The start date of the break
*/
override var pauseDate: Date? = null
set(value) {
field = value
// this.updateRowRepresentation()
}
// The session set containing the sessions, which can contain multiple endedSessions
var sessionSet: SessionSet? = null
@ -326,9 +321,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
// The small blind value
var cgOldSmallBlind: Double? = null
set(value) {
field = value
}
// The big blind value
var cgOldBigBlind: Double? = null
@ -367,10 +359,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
// The entry fee of the tournament
var tournamentEntryFee: Double? = null
set(value) {
field = value
// this.result?.computeNumberOfRebuy()
}
// The total number of players who participated in the tournament
var tournamentNumberOfPlayers: Int? = null
@ -389,10 +377,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
// The number of hands played during the sessions
var handsCount: Int? = null
set(value) {
field = value
// this.computeStats()
}
fun bankrollHasBeenUpdated() {
this.generateStakes()
@ -690,7 +674,7 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
/**
* Return the game titleResId
* Example: NL Holdem
* Example: NL Hold'em
*/
fun getFormattedGame(): String {
var gameTitle = ""
@ -702,7 +686,7 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
if (game != null) {
gameTitle += game?.name
}
return if (gameTitle.isNotBlank()) gameTitle else NULL_TEXT
return gameTitle.ifBlank { NULL_TEXT }
}
fun getFormattedStakes(): String {
@ -793,7 +777,6 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
SessionPropertiesRow.CASHED_OUT, SessionPropertiesRow.PRIZE -> {
val localResult = getOrCreateResult()
localResult.cashout = value as Double?
Timber.d("localResult cashout = ${localResult.cashout}")
if (value != null) {
this.end()
}
@ -869,7 +852,7 @@ open class Session : RealmObject(), Savable, RowUpdatable, RowRepresentable, Tim
SessionPropertiesRow.NUMBER_OF_TABLES -> this.numberOfTables = (value as Double?)?.toInt() ?: 1
is CustomField -> {
customFieldEntries.filter { it.customField?.id == row.id }.let {
customFieldEntries.removeAll(it)
customFieldEntries.removeAll(it.toSet())
}
when (row.type) {
CustomField.Type.AMOUNT.uniqueIdentifier,

@ -11,7 +11,6 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.DiffUtil
import io.realm.RealmModel
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -44,7 +43,6 @@ import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.extensions.*
import timber.log.Timber
import java.util.*
import kotlin.collections.ArrayList
class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepresentableDataSource, ResultCaptureTypeDelegate {

@ -157,13 +157,3 @@ fun Realm.computableResult(session: Session): ComputableResult? {
}
return crs.firstOrNull()
}
//fun Realm.copySessionFromRealm(session: Session): Session {
// val copy = this.copyFromRealm(session)
// copy.result?.inverseSession = WeakReference(copy)
//// this.computableResult(session)?.let {
//// val computableResult = this.copyFromRealm(it)
//// copy.inverseComputableResult = WeakReference(computableResult)
//// }
// return copy
//}
Loading…
Cancel
Save