|
|
|
@ -223,10 +223,10 @@ sealed class Criteria(override var uniqueIdentifier: Int) : IntIdentifiable, Row |
|
|
|
is Years -> { |
|
|
|
is Years -> { |
|
|
|
val years = arrayListOf<Query>() |
|
|
|
val years = arrayListOf<Query>() |
|
|
|
val realm = Realm.getDefaultInstance() |
|
|
|
val realm = Realm.getDefaultInstance() |
|
|
|
val lastSession = realm.where<Session>().sort("startDate", Sort.DESCENDING).findFirst() |
|
|
|
val lastSession = realm.where<Session>().isNotNull("startDate").sort("startDate", Sort.DESCENDING).findFirst() |
|
|
|
val yearNow = lastSession?.year ?: return years |
|
|
|
val yearNow = lastSession?.year ?: return years |
|
|
|
|
|
|
|
|
|
|
|
realm.where<Session>().sort("year", Sort.ASCENDING).findFirst()?.year?.let { |
|
|
|
realm.where<Session>().isNotNull("startDate").sort("year", Sort.ASCENDING).findFirst()?.year?.let { |
|
|
|
for (index in 0..(yearNow - it)) { |
|
|
|
for (index in 0..(yearNow - it)) { |
|
|
|
val yearCondition = QueryCondition.AnyYear().apply { |
|
|
|
val yearCondition = QueryCondition.AnyYear().apply { |
|
|
|
listOfValues = arrayListOf(it + index) |
|
|
|
listOfValues = arrayListOf(it + index) |
|
|
|
|