forked from github/wulkanowy-mirror
Filter out empty items in grade summary (#857)
This commit is contained in:
parent
5c0160a24d
commit
d8d13c73fb
@ -109,7 +109,17 @@ class GradeSummaryPresenter @Inject constructor(
|
||||
|
||||
private fun createGradeSummaryItems(items: List<GradeDetailsWithAverage>): List<GradeSummary> {
|
||||
return items
|
||||
.filter { !checkEmpty(it) }
|
||||
.sortedBy { it.subject }
|
||||
.map { it.summary.copy(average = it.average) }
|
||||
}
|
||||
|
||||
private fun checkEmpty(gradeSummary: GradeDetailsWithAverage): Boolean {
|
||||
return gradeSummary.run {
|
||||
summary.finalGrade.isBlank()
|
||||
&& summary.predictedGrade.isBlank()
|
||||
&& average == .0
|
||||
&& points == "-"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user