1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-24 05:26:11 -06:00

Fix item sorting in grades details (#209)

This commit is contained in:
Mikołaj Pich 2019-01-06 23:56:01 +01:00 committed by Rafał Borcz
parent ca504f6efc
commit 450ae4e124

View File

@ -97,6 +97,7 @@ class GradeDetailsPresenter @Inject constructor(
disposable.add(studentRepository.getCurrentStudent() disposable.add(studentRepository.getCurrentStudent()
.flatMap { semesterRepository.getSemesters(it) } .flatMap { semesterRepository.getSemesters(it) }
.flatMap { gradeRepository.getGrades(it.first { item -> item.semesterId == semesterId }, forceRefresh) } .flatMap { gradeRepository.getGrades(it.first { item -> item.semesterId == semesterId }, forceRefresh) }
.map { it.sortedByDescending { grade -> grade.date } }
.map { it.map { item -> item.changeModifier(preferencesRepository.gradePlusModifier, preferencesRepository.gradeMinusModifier) } } .map { it.map { item -> item.changeModifier(preferencesRepository.gradePlusModifier, preferencesRepository.gradeMinusModifier) } }
.map { createGradeItems(it.groupBy { grade -> grade.subject }.toSortedMap()) } .map { createGradeItems(it.groupBy { grade -> grade.subject }.toSortedMap()) }
.subscribeOn(schedulers.backgroundThread) .subscribeOn(schedulers.backgroundThread)