|
|
|
|
@ -3,10 +3,7 @@ package net.pokeranalytics.android.util |
|
|
|
|
import io.realm.Realm |
|
|
|
|
import io.realm.kotlin.where |
|
|
|
|
import net.pokeranalytics.android.model.Limit |
|
|
|
|
import net.pokeranalytics.android.model.realm.Bankroll |
|
|
|
|
import net.pokeranalytics.android.model.realm.Game |
|
|
|
|
import net.pokeranalytics.android.model.realm.Location |
|
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
|
import net.pokeranalytics.android.util.extensions.getOrCreate |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import java.util.* |
|
|
|
|
@ -33,8 +30,9 @@ class FakeDataManager { |
|
|
|
|
val games = realm.where<Game>().findAll() |
|
|
|
|
val bankroll = realm.where<Bankroll>().findAll().firstOrNull() |
|
|
|
|
val locations = realm.where<Location>().findAll() |
|
|
|
|
val players = realm.where<Player>().findAll() |
|
|
|
|
|
|
|
|
|
if (locations.size == 0) { |
|
|
|
|
if (locations.isEmpty()) { |
|
|
|
|
realm.executeTransaction { |
|
|
|
|
listOf("Bellagio", "Aria", "Borgata").map { |
|
|
|
|
realm.getOrCreate<Location>(it) |
|
|
|
|
@ -42,6 +40,20 @@ class FakeDataManager { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (players.isEmpty()) { |
|
|
|
|
val playersName = listOf("Candice Cole", "Owen Barnes", "Ramona Harper", "Julie Grant", "Zoey Wood", "Hugh Nelson", "Christi Adams", "Keith Shaw") |
|
|
|
|
val playersSummary = listOf("", "Be careful of this boy", "😄", "", "- Creepy\n- Hard to play", "", "", "👍👍") |
|
|
|
|
|
|
|
|
|
realm.executeTransaction { |
|
|
|
|
playersName.forEachIndexed { index, name -> |
|
|
|
|
val player = Player() |
|
|
|
|
player.name = name |
|
|
|
|
player.summary = playersSummary[index] |
|
|
|
|
realm.copyToRealm(player) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Test endedSessions |
|
|
|
|
|
|
|
|
|
Timber.d("*** Start creating ${numberOfSessions} fake computables...") |
|
|
|
|
|