Add pupil description with school name or class code
This commit is contained in:
parent
b70257fbee
commit
da80d5ece0
4 changed files with 19 additions and 4 deletions
|
@ -42,7 +42,10 @@ data class Diary(
|
|||
val year: Int,
|
||||
|
||||
@SerializedName("Okresy")
|
||||
val semesters: List<Semester> = emptyList()
|
||||
val semesters: List<Semester> = emptyList(),
|
||||
|
||||
@SerializedName("UczenPelnaNazwa")
|
||||
val fullName: String
|
||||
) {
|
||||
data class Semester(
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ data class Pupil(
|
|||
val studentId: Int,
|
||||
val studentName: String,
|
||||
val schoolSymbol: String,
|
||||
@Deprecated("use description val")
|
||||
val schoolName: String,
|
||||
val description: String,
|
||||
val loginType: Api.LoginType
|
||||
)
|
||||
|
|
|
@ -22,6 +22,8 @@ class StudentAndParentResponse {
|
|||
|
||||
@Selector("option")
|
||||
lateinit var name: String
|
||||
|
||||
lateinit var description: String
|
||||
}
|
||||
|
||||
class Diary {
|
||||
|
|
|
@ -47,7 +47,8 @@ class RegisterRepository(
|
|||
studentId = pupil.id,
|
||||
studentName = pupil.name,
|
||||
schoolSymbol = getExtractedSchoolSymbolFromUrl(schoolUrl),
|
||||
schoolName = "?",
|
||||
description = pupil.description,
|
||||
schoolName = pupil.description,
|
||||
loginType = loginType
|
||||
)
|
||||
}
|
||||
|
@ -60,13 +61,20 @@ class RegisterRepository(
|
|||
private fun getStudents(symbol: String, schoolUrl: String): Single<List<StudentAndParentResponse.Pupil>> {
|
||||
url.schoolId = getExtractedSchoolSymbolFromUrl(schoolUrl)
|
||||
url.symbol = symbol
|
||||
return if (!useNewStudent) snp.getSchoolInfo(schoolUrl).map { it.students }
|
||||
else student.getSchoolInfo(url.generate(ServiceManager.UrlGenerator.Site.STUDENT) + "UczenDziennik.mvc/Get").map { diary -> diary.data?.distinctBy { it.studentId } }
|
||||
return if (!useNewStudent) snp.getSchoolInfo(schoolUrl).map { res ->
|
||||
res.students.map { pupil ->
|
||||
pupil.apply {
|
||||
description = res.schoolName
|
||||
}
|
||||
}
|
||||
} else student.getSchoolInfo(url.generate(ServiceManager.UrlGenerator.Site.STUDENT) + "UczenDziennik.mvc/Get")
|
||||
.map { diary -> diary.data?.distinctBy { it.studentId } }
|
||||
.map { diaries ->
|
||||
diaries.map {
|
||||
StudentAndParentResponse.Pupil().apply {
|
||||
id = it.studentId
|
||||
name = "${it.studentName} ${it.studentSurname}"
|
||||
description = it.symbol + " " + (it.year - it.level + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue