Handle point grades with decimal counter
This commit is contained in:
parent
ac93bbcc8a
commit
e2a98931cb
3 changed files with 29 additions and 2 deletions
|
@ -16,7 +16,7 @@ fun GradesResponse.mapGradesList(): List<Grade> {
|
|||
else entry.substringBeforeLast(")").substringAfter(" (")
|
||||
}
|
||||
entry = entry.substringBefore(" (").run {
|
||||
if (isPoints && matches("\\d+/\\d+".toRegex())) getGradePointPercent()
|
||||
if (isPoints && matches("\\d+\\.?\\d+/\\d+".toRegex())) getGradePointPercent()
|
||||
else if (length > 4) "..."
|
||||
else this
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ class GradesTest : BaseLocalTest() {
|
|||
fun getAllTest() {
|
||||
assertEquals(10, snp.size) // 2 items are skipped
|
||||
assertEquals(12, student.size)
|
||||
assertEquals(3, studentPoints.size)
|
||||
assertEquals(4, studentPoints.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -297,6 +297,24 @@ class GradesTest : BaseLocalTest() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getGrade_decimalCounter() {
|
||||
with(studentPoints[3]) {
|
||||
assertEquals("Fizyka", subject)
|
||||
assertEquals("95%", entry)
|
||||
assertEquals(0, value)
|
||||
assertEquals(.0, modifier, .0)
|
||||
assertEquals("47.5/50", comment)
|
||||
assertEquals("000000", color)
|
||||
assertEquals("K3", symbol)
|
||||
assertEquals("Liczebniki", description)
|
||||
assertEquals("1,00", weight)
|
||||
assertEquals(0.0, weightValue, .0)
|
||||
assertEquals(getDate(2018, 12, 3), date)
|
||||
assertEquals("Jakub Michalak", teacher)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getGrade_doublePlus() {
|
||||
with(student[11]) {
|
||||
|
|
|
@ -46,6 +46,15 @@
|
|||
"KodKolumny": "O",
|
||||
"DataOceny": "04.12.2018",
|
||||
"KolorOceny": 0
|
||||
},
|
||||
{
|
||||
"Nauczyciel": "Jakub Michalak",
|
||||
"Wpis": "47.5/50",
|
||||
"Waga": 1.00,
|
||||
"NazwaKolumny": "Liczebniki",
|
||||
"KodKolumny": "K3",
|
||||
"DataOceny": "03.12.2018",
|
||||
"KolorOceny": 0
|
||||
}
|
||||
],
|
||||
"ProponowanaOcenaRoczna": "",
|
||||
|
|
Loading…
Reference in a new issue