Merge branch 'master' of gitlab.com:stax-river/poker-analytics

feature/top10
Aurelien Hubert 7 years ago
commit c6f4ab9080
  1. 4
      app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt
  2. 4
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/SessionObserverFragment.kt

@ -101,7 +101,7 @@ class FavoriteSessionFinder {
*/ */
private fun favoriteSession(sessionType: Int, location: Location?, realm: Realm, context: Context) : Session? { private fun favoriteSession(sessionType: Int, location: Location?, realm: Realm, context: Context) : Session? {
var lastSessionsQuery = realm.where(Session::class.java).equalTo("type", sessionType) val lastSessionsQuery = realm.where(Session::class.java).equalTo("type", sessionType)
if (location != null) { if (location != null) {
lastSessionsQuery.equalTo("location.id", location.id) lastSessionsQuery.equalTo("location.id", location.id)
} }
@ -110,7 +110,7 @@ class FavoriteSessionFinder {
.limit(FAVORITE_SIGNIFICANT_SESSIONS) .limit(FAVORITE_SIGNIFICANT_SESSIONS)
.findAll() .findAll()
var counters= hashMapOf<String, Counter>() val counters= hashMapOf<String, Counter>()
lastSessions.forEach { session -> lastSessions.forEach { session ->
val representation = session.parameterRepresentation(context) val representation = session.parameterRepresentation(context)
val counter = counters[representation] val counter = counters[representation]

@ -10,14 +10,14 @@ open class SessionObserverFragment : PokerAnalyticsFragment() {
init { init {
val realm = Realm.getDefaultInstance() val realm = Realm.getDefaultInstance()
this.sessions = realm.where(Session::class.java).findAll() this.sessions = realm.where(Session::class.java).isNotNull("timeFrame.endDate").findAll()
this.sessions.addChangeListener { _, _ -> this.sessions.addChangeListener { _, _ ->
this.sessionsChanged() this.sessionsChanged()
} }
} }
open fun sessionsChanged() { open fun sessionsChanged() {
// to override
} }
} }
Loading…
Cancel
Save