Renaming Result.netResult into Result.onlineNet

csv
Laurent 6 years ago
parent 97ed99750f
commit 420055ab1d
  1. 4
      app/build.gradle
  2. 2
      app/src/androidTest/java/net/pokeranalytics/android/components/SessionInstrumentedUnitTest.kt
  3. 2
      app/src/androidTest/java/net/pokeranalytics/android/unitTests/BankrollInstrumentedUnitTest.kt
  4. 4
      app/src/androidTest/java/net/pokeranalytics/android/unitTests/DeleteInstrumentedUnitTest.kt
  5. 2
      app/src/androidTest/java/net/pokeranalytics/android/unitTests/StatPerformanceUnitTest.kt
  6. 8
      app/src/androidTest/java/net/pokeranalytics/android/unitTests/StatsInstrumentedUnitTest.kt
  7. 2
      app/src/main/java/net/pokeranalytics/android/PokerAnalyticsApplication.kt
  8. 1
      app/src/main/java/net/pokeranalytics/android/model/migrations/PokerAnalyticsMigration.kt
  9. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt
  10. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  11. 2
      app/src/main/java/net/pokeranalytics/android/util/csv/SessionCSVDescriptor.kt

@ -29,8 +29,8 @@ android {
applicationId "net.pokeranalytics.android"
minSdkVersion 23
targetSdkVersion 28
versionCode 48
versionName "2.1.2"
versionCode 51
versionName "2.1.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

@ -30,7 +30,7 @@ open class SessionInstrumentedUnitTest : RealmInstrumentedUnitTest() {
session.numberOfTables = numberOfTable
session.tableSize = tableSize
session.startDate = startDate
session.result?.netResult = netResult
session.result?.onlineNet = netResult
val cal = Calendar.getInstance() // creates calendar
cal.time = startDate // sets calendar time/date
cal.add(Calendar.HOUR_OF_DAY, endDate) // adds one hour

@ -28,7 +28,7 @@ class BankrollInstrumentedUnitTest : SessionInstrumentedUnitTest() {
// convenience extension
fun Session.Companion.testInstance(netResult: Double, startDate: Date, endDate: Date?): Session {
val session: Session = newInstance(super.mockRealm, false)
session.result?.netResult = netResult
session.result?.onlineNet = netResult
session.startDate = startDate
session.endDate = endDate
return session

@ -33,8 +33,8 @@ class DeleteInstrumentedUnitTest : RealmInstrumentedUnitTest() {
s1.bankroll = br1
s2.bankroll = br2
s1.result?.netResult = 100.0
s2.result?.netResult = 200.0
s1.result?.onlineNet = 100.0
s2.result?.onlineNet = 200.0
realm.commitTransaction()

@ -28,7 +28,7 @@ class StatPerformanceUnitTest : SessionInstrumentedUnitTest() {
realm.commitTransaction()
val d1 = Date()
realm.where(Result::class.java).sum("netResult")
realm.where(Result::class.java).sum("onlineNet")
val d2 = Date()
val duration = (d2.time - d1.time)

@ -593,8 +593,8 @@ class StatsInstrumentedUnitTest : SessionInstrumentedUnitTest() {
b2.currency = c2
s1.bankroll = b1
s2.bankroll = b2
s1.result?.netResult = 100.0
s2.result?.netResult = 200.0
s1.result?.onlineNet = 100.0
s2.result?.onlineNet = 200.0
}
@ -629,8 +629,8 @@ class StatsInstrumentedUnitTest : SessionInstrumentedUnitTest() {
b2.currency = c2
s1.bankroll = b1
s2.bankroll = b2
s1.result?.netResult = 100.0
s2.result?.netResult = 200.0
s1.result?.onlineNet = 100.0
s2.result?.onlineNet = 200.0
}

@ -33,7 +33,7 @@ class PokerAnalyticsApplication : Application() {
Realm.init(this)
val realmConfiguration = RealmConfiguration.Builder()
.name(Realm.DEFAULT_REALM_NAME)
.schemaVersion(7)
.schemaVersion(8)
.migration(PokerAnalyticsMigration())
.initialData(Seed(this))
.build()

@ -168,6 +168,7 @@ class PokerAnalyticsMigration : RealmMigration {
}
schema.get("Session")?.addField("tournamentPrizepool", Double::class.java)?.setNullable("tournamentPrizepool", true)
schema.get("Result")?.renameField("netResult", "onlineNet")
currentVersion++
}

@ -49,7 +49,7 @@ open class Result : RealmObject(), Filterable {
/**
* The net result
*/
var netResult: Double? = null
var onlineNet: Double? = null
set(value) {
var errorMessage: String? = null
@ -118,7 +118,7 @@ open class Result : RealmObject(), Filterable {
val transactionsSum = transactions.sumByDouble { it.amount }
this.netResult?.let {
this.onlineNet?.let {
this.net = it + transactionsSum
} ?: run {
val buyin = this.buyin ?: 0.0
@ -132,8 +132,8 @@ open class Result : RealmObject(), Filterable {
// val cashOut = this.cashout ?: 0.0
// this.net = cashOut - buyin + transactionsSum
// } else {
// val netResult = this.netResult ?: 0.0
// this.net = netResult + transactionsSum
// val onlineNet = this.onlineNet ?: 0.0
// this.net = onlineNet + transactionsSum
// }
// Precompute results

@ -476,7 +476,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
val hasNetResult: Boolean
get() {
return this.result?.netResult != null
return this.result?.onlineNet != null
}
// Manageable
@ -788,7 +788,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
SessionRow.BREAK_TIME -> if (this.breakDuration > 0.0) this.breakDuration.toMinutes() else NULL_TEXT
SessionRow.BUY_IN -> this.result?.buyin?.toCurrency(currency) ?: NULL_TEXT
SessionRow.CASHED_OUT, SessionRow.PRIZE -> this.result?.cashout?.toCurrency(currency) ?: NULL_TEXT
SessionRow.NET_RESULT -> this.result?.netResult?.toCurrency(currency) ?: NULL_TEXT
SessionRow.NET_RESULT -> this.result?.onlineNet?.toCurrency(currency) ?: NULL_TEXT
SessionRow.COMMENT -> if (this.comment.isNotEmpty()) this.comment else NULL_TEXT
SessionRow.END_DATE -> this.endDate?.shortDateTime() ?: NULL_TEXT
SessionRow.GAME -> getFormattedGame()
@ -903,7 +903,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
)
SessionRow.NET_RESULT -> row.editingDescriptors(
mapOf(
"defaultValue" to result?.netResult
"defaultValue" to result?.onlineNet
)
)
SessionRow.COMMENT -> row.editingDescriptors(
@ -998,7 +998,7 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
}
SessionRow.NET_RESULT -> {
this.result?.let { result ->
result.netResult = value as Double?
result.onlineNet = value as Double?
}
}
SessionRow.COMMENT -> comment = value as String? ?: ""

@ -253,7 +253,7 @@ class SessionCSVDescriptor(source: DataSource, private var isTournament: Boolean
session.bankroll = bankroll
netResult?.let {
session.result?.netResult = it // need to be set after BR
session.result?.onlineNet = it // need to be set after BR
}
session.result?.buyin?.let {

Loading…
Cancel
Save