Trim whitespaces from strings in GradeSummary
This commit is contained in:
parent
3ecb494372
commit
189f5ecee0
3 changed files with 13 additions and 13 deletions
|
@ -33,14 +33,14 @@ fun LocalDate.getLastMonday(): LocalDate = with(previousOrSame(MONDAY))
|
|||
fun LocalDate.getSchoolYear(): Int = if (month.value > 8) year else year - 1
|
||||
|
||||
fun getGradeShortValue(value: String?): String {
|
||||
return when (value) {
|
||||
return when (value?.trim()) {
|
||||
"celujący" -> "6"
|
||||
"bardzo dobry" -> "5"
|
||||
"dobry" -> "4"
|
||||
"dostateczny" -> "3"
|
||||
"dopuszczający" -> "2"
|
||||
"niedostateczny" -> "1"
|
||||
else -> value ?: ""
|
||||
else -> value.orEmpty().trim()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ fun GradesResponse.mapGradesSummary() = gradesWithSubjects.map { subject ->
|
|||
GradeSummary(
|
||||
visibleSubject = subject.visibleSubject,
|
||||
order = subject.order,
|
||||
name = subject.name,
|
||||
name = subject.name.trim(),
|
||||
average = subject.average,
|
||||
predicted = getGradeShortValue(subject.proposed),
|
||||
final = getGradeShortValue(subject.annual),
|
||||
pointsSum = subject.pointsSum.takeIf { it != "-" }.orEmpty(),
|
||||
proposedPoints = subject.proposedPoints.orEmpty(),
|
||||
finalPoints = subject.finalPoints.orEmpty()
|
||||
pointsSum = subject.pointsSum.takeIf { it != "-" }.orEmpty().trim(),
|
||||
proposedPoints = subject.proposedPoints.orEmpty().trim(),
|
||||
finalPoints = subject.finalPoints.orEmpty().trim(),
|
||||
)
|
||||
}.sortedBy { it.name }.toList()
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
"KolorOceny": 15748172
|
||||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "",
|
||||
"OcenaRoczna": "",
|
||||
"ProponowanaOcenaRoczna": " ",
|
||||
"OcenaRoczna": " ",
|
||||
"ProponowanaOcenaRocznaPunkty": null,
|
||||
"OcenaRocznaPunkty": null,
|
||||
"Srednia": 0,
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "3",
|
||||
"OcenaRoczna": "dobry",
|
||||
"OcenaRoczna": " dobry ",
|
||||
"ProponowanaOcenaRocznaPunkty": null,
|
||||
"OcenaRocznaPunkty": null,
|
||||
"Srednia": 0,
|
||||
|
@ -147,7 +147,7 @@
|
|||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "4/5",
|
||||
"OcenaRoczna": "bardzo dobry",
|
||||
"OcenaRoczna": " bardzo dobry",
|
||||
"ProponowanaOcenaRocznaPunkty": null,
|
||||
"OcenaRocznaPunkty": null,
|
||||
"Srednia": 0,
|
||||
|
@ -177,7 +177,7 @@
|
|||
"KolorOceny": 0
|
||||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "4-",
|
||||
"ProponowanaOcenaRoczna": "4- ",
|
||||
"OcenaRoczna": "5-",
|
||||
"ProponowanaOcenaRocznaPunkty": null,
|
||||
"OcenaRocznaPunkty": null,
|
||||
|
@ -199,8 +199,8 @@
|
|||
"KolorOceny": 0
|
||||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "",
|
||||
"OcenaRoczna": "",
|
||||
"ProponowanaOcenaRoczna": " ",
|
||||
"OcenaRoczna": " ",
|
||||
"ProponowanaOcenaRocznaPunkty": null,
|
||||
"OcenaRocznaPunkty": null,
|
||||
"Srednia": 0,
|
||||
|
|
Loading…
Reference in a new issue