Add categoryType and point fields to Note

This commit is contained in:
Mikołaj Pich 2020-02-04 21:12:08 +01:00
parent 16d36ddf16
commit 36111831d7
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
4 changed files with 32 additions and 5 deletions

View file

@ -23,4 +23,13 @@ class Note {
@SerializedName("TrescUwagi")
@Selector(".wartosc", index = 2)
lateinit var content: String
@SerializedName("Punkty")
lateinit var points: String
@SerializedName("PokazPunkty")
var showPoints = false
@SerializedName("KategoriaTyp")
var categoryType: Int = 0
}

View file

@ -5,19 +5,28 @@
"TrescUwagi": "Przeszkadzanie w prowadzeniu lekcji",
"Kategoria": "Zachowanie na lekcji",
"DataWpisu": "2016-10-01 00:00:00",
"Nauczyciel": "Kochański Leszek [KL]"
"Nauczyciel": "Kochański Leszek [KL]",
"Punkty": "",
"PokazPunkty": false,
"KategoriaTyp": 1
},
{
"TrescUwagi": "Udział w przygotowaniu spektaklu",
"Kategoria": "Reprezentowanie szkoły",
"DataWpisu": "2016-12-26 00:00:00",
"Nauczyciel": "Ochocka Zofia [PZ]"
"Nauczyciel": "Ochocka Zofia [PZ]",
"Punkty": "",
"PokazPunkty": false,
"KategoriaTyp": 2
},
{
"TrescUwagi": "Pomoc przy pikniku charytatywnym",
"Kategoria": "Zaangażowanie społeczne",
"DataWpisu": "2017-06-26 00:00:00",
"Nauczyciel": "Jan Kowalski [JK]"
"Nauczyciel": "Jan Kowalski [JK]",
"Punkty": "",
"PokazPunkty": false,
"KategoriaTyp": 3
}
],
"Osiagniecia": []

View file

@ -12,9 +12,12 @@ fun List<ApiNote>.mapNotes(dictionaries: Dictionaries): List<Note> {
Note(
date = it.entryDate.toLocalDate(),
content = it.content,
category = dictionaries.noteCategories.singleOrNull { cat -> cat.id == it.noteCategoryId }?.name.orEmpty(),
teacherSymbol = dictionaries.teachers.singleOrNull { teacher -> teacher.id == it.employeeId }?.code.orEmpty(),
teacher = "${it.employeeName} ${it.employeeSurname}"
teacher = "${it.employeeName} ${it.employeeSurname}",
category = dictionaries.noteCategories.singleOrNull { cat -> cat.id == it.noteCategoryId }?.name.orEmpty(),
categoryType = 0,
showPoints = false,
points = ""
)
}
}
@ -26,6 +29,9 @@ fun List<ScrapperNote>.mapNotes(): List<Note> {
teacher = it.teacher,
teacherSymbol = it.teacherSymbol,
category = it.category,
categoryType = it.categoryType,
showPoints = it.showPoints,
points = it.points,
content = it.content
)
}

View file

@ -7,5 +7,8 @@ data class Note(
var teacher: String,
var teacherSymbol: String,
var category: String,
var categoryType: Int,
var showPoints: Boolean,
var points: String,
var content: String
)