Removes useless hands field from Session + fix build

hh
Laurent 6 years ago
parent 5bfdee584f
commit 4ff41f6391
  1. 5
      app/src/main/java/net/pokeranalytics/android/model/migrations/PokerAnalyticsMigration.kt
  2. 5
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/fragment/SessionFragment.kt

@ -177,8 +177,9 @@ class PokerAnalyticsMigration : RealmMigration {
if (currentVersion == 8) {
schema.get("HandHistory")?.let { hhSchema ->
schema.get("Session")?.let {
hhSchema.addRealmObjectField("session", it)
schema.get("Session")?.let { sessionSchema ->
sessionSchema.removeField("hands")
hhSchema.addRealmObjectField("session", sessionSchema)
} ?: throw PAIllegalStateException("Session schema not found")
hhSchema.addField("smallBlind", Double::class.java)
hhSchema.addField("bigBlind", Double::class.java)

@ -269,7 +269,10 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat
var numberOfTables: Int = 1
// The hands list associated with the Session
var hands: RealmList<HandHistory> = RealmList()
// var hands: RealmList<HandHistory> = RealmList()
@LinkingObjects("session")
val handHistories: RealmResults<HandHistory>? = null
// The list of opponents who participated to the session
var opponents: RealmList<Player> = RealmList()

@ -358,7 +358,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate {
}
private fun addHandHistory() {
HandHistoryActivity.newInstance(this, this.currentSession)
HandHistoryActivity.newInstance(this, this.currentSession, true)
}
/**

Loading…
Cancel
Save