|
|
|
|
@ -5,8 +5,11 @@ import io.realm.Realm |
|
|
|
|
import io.realm.RealmConfiguration |
|
|
|
|
import io.realm.RealmResults |
|
|
|
|
import io.realm.kotlin.where |
|
|
|
|
import net.pokeranalytics.android.model.Limit |
|
|
|
|
import net.pokeranalytics.android.model.realm.Game |
|
|
|
|
import net.pokeranalytics.android.model.realm.Result |
|
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
|
import net.pokeranalytics.android.model.realm.TimeFrame |
|
|
|
|
import net.pokeranalytics.android.util.PokerAnalyticsLogs |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import java.util.* |
|
|
|
|
@ -86,6 +89,53 @@ class PokerAnalyticsApplication : Application() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (BuildConfig.DEBUG) { |
|
|
|
|
val sessions = realm.where<Session>().findAll() |
|
|
|
|
if (sessions.size < 10) { |
|
|
|
|
for (index in 0..50) { |
|
|
|
|
|
|
|
|
|
realm.executeTransaction { |
|
|
|
|
val session = Session() |
|
|
|
|
session.id = UUID.randomUUID().toString() |
|
|
|
|
|
|
|
|
|
val calendar = Calendar.getInstance() |
|
|
|
|
calendar.set( |
|
|
|
|
(2017..2018).random(), |
|
|
|
|
(0..11).random(), |
|
|
|
|
(0..28).random(), |
|
|
|
|
(0..23).random(), |
|
|
|
|
(0..59).random() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
val startDate = calendar.time |
|
|
|
|
calendar.add(Calendar.HOUR_OF_DAY, (2..12).random()) |
|
|
|
|
calendar.add(Calendar.MINUTE, (0..59).random()) |
|
|
|
|
val endDate = calendar.time |
|
|
|
|
|
|
|
|
|
val timeFrame = TimeFrame() |
|
|
|
|
timeFrame.setDate(startDate, endDate) |
|
|
|
|
session.timeFrame = timeFrame |
|
|
|
|
session.creationDate = startDate |
|
|
|
|
|
|
|
|
|
session.limit = Limit.values().random().ordinal |
|
|
|
|
session.game = realm.where<Game>().findAll().random() |
|
|
|
|
|
|
|
|
|
val result = Result() |
|
|
|
|
result.buyin = arrayListOf(100, 200, 300, 500, 1000, 2000).random().toDouble() |
|
|
|
|
result.netResult = arrayListOf( |
|
|
|
|
-2500.0, -2000.0, -1500.0, -1000.0, -500.0, 200.0, 1000.0, 1500.0, |
|
|
|
|
2500.0 |
|
|
|
|
).random() |
|
|
|
|
session.result = result |
|
|
|
|
|
|
|
|
|
realm.copyToRealmOrUpdate(session) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
realm.close() |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |