diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/data/api/UsosApiUser.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/data/api/UsosApiUser.kt index 29a3e22b..806c2fd8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/data/api/UsosApiUser.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/data/api/UsosApiUser.kt @@ -53,7 +53,7 @@ class UsosApiUser( data.studentId = json.getInt("id") ?: data.studentId profile?.studentNameLong = studentName profile?.studentNameShort = studentName.getShortName() - profile?.studentNumber = json.getInt("student_number", -1) + profile?.studentNumber = json.getString("student_number")?.replace(Regex("[^0-9]"), "")?.toIntOrNull() ?: -1 profile?.studentClassName = programmes.getJsonObject(0).getJsonObject("programme").getString("id") profile?.studentClassName?.let { diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/firstlogin/UsosFirstLogin.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/firstlogin/UsosFirstLogin.kt index 4d900673..32c9c4c5 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/firstlogin/UsosFirstLogin.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/edziennik/usos/firstlogin/UsosFirstLogin.kt @@ -68,7 +68,7 @@ class UsosFirstLogin(val data: DataUsos, val onSuccess: () -> Unit) { "studentId" to json.getInt("id"), ), ).also { - it.studentNumber = json.getInt("student_number", -1) + it.studentNumber = json.getString("student_number")?.replace(Regex("[^0-9]"), "")?.toIntOrNull() ?: -1 it.studentClassName = programmes.getJsonObject(0).getJsonObject("programme").getString("id") }