forked from github/wulkanowy-mirror
Fix grade sorting (#825)
This commit is contained in:
parent
d558c4db66
commit
c3a6f8253a
@ -171,10 +171,13 @@ class GradeDetailsPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createGradeItems(items: List<GradeDetailsWithAverage>): List<GradeDetailsItem> {
|
private fun createGradeItems(items: List<GradeDetailsWithAverage>): List<GradeDetailsItem> {
|
||||||
return items.filter { it.grades.isNotEmpty() }.map { (subject, average, points, _, grades) ->
|
return items
|
||||||
val subItems = grades.map {
|
.filter { it.grades.isNotEmpty() }
|
||||||
GradeDetailsItem(it, ViewType.ITEM)
|
.sortedBy { it.subject }
|
||||||
}
|
.map { (subject, average, points, _, grades) ->
|
||||||
|
val subItems = grades
|
||||||
|
.sortedByDescending { it.date }
|
||||||
|
.map { GradeDetailsItem(it, ViewType.ITEM) }
|
||||||
|
|
||||||
listOf(GradeDetailsItem(GradeDetailsHeader(
|
listOf(GradeDetailsItem(GradeDetailsHeader(
|
||||||
subject = subject,
|
subject = subject,
|
||||||
|
@ -103,14 +103,8 @@ class GradeSummaryPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createGradeSummaryItems(items: List<GradeDetailsWithAverage>): List<GradeSummary> {
|
private fun createGradeSummaryItems(items: List<GradeDetailsWithAverage>): List<GradeSummary> {
|
||||||
return items.map {
|
return items
|
||||||
it.summary.copy(average = it.average)
|
.sortedBy { it.subject }
|
||||||
}
|
.map { it.summary.copy(average = it.average) }
|
||||||
}
|
|
||||||
|
|
||||||
private fun checkEmpty(gradeSummary: GradeSummary, averages: List<Triple<String, Double, String>>): Boolean {
|
|
||||||
return gradeSummary.run {
|
|
||||||
finalGrade.isBlank() && predictedGrade.isBlank() && averages.singleOrNull { it.first == subject } == null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user