Fix symbol in Student

This commit is contained in:
Mikołaj Pich 2019-11-14 14:07:16 +01:00
parent 79ad6d7eb3
commit 95bcb8bf46
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
2 changed files with 4 additions and 4 deletions

View file

@ -187,7 +187,7 @@ class Sdk {
fun getStudents(): Single<List<Student>> {
return when (mode) {
Mode.API -> mobile.getApiStudents(token, pin, symbol).map { it.mapStudents() }
Mode.API -> mobile.getApiStudents(token, pin, symbol).map { it.mapStudents(symbol) }
Mode.SCRAPPER -> {
scrapper.run {
ssl = this@Sdk.ssl
@ -215,7 +215,7 @@ class Sdk {
scrapper.getToken().compose(ScrapperExceptionTransformer()).flatMap {
mobile.getApiStudents(it.token, it.pin, it.symbol)
}.map { apiStudents ->
apiStudents.mapStudents().map { apiStudent ->
apiStudents.mapStudents(symbol).map { apiStudent ->
apiStudent.copy(
loginMode = Mode.HYBRID,
scrapperHost = scrapperHost,

View file

@ -5,11 +5,11 @@ import io.github.wulkanowy.sdk.pojo.Student
import io.github.wulkanowy.api.register.Student as ScrapperStudent
import io.github.wulkanowy.sdk.mobile.register.Student as ApiStudent
fun List<ApiStudent>.mapStudents(): List<Student> {
fun List<ApiStudent>.mapStudents(symbol: String): List<Student> {
return map {
Student(
email = it.userLogin,
symbol = it.reportingUnitSymbol,
symbol = symbol,
studentId = it.id,
userLoginId = it.userLoginId,
classId = it.classId,