forked from github/szkolny
[API/Edudziennik] Fix getting students on first login.
This commit is contained in:
parent
e3741f1c75
commit
844d5b33bc
@ -85,8 +85,8 @@ object Regexes {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
val EDUDZIENNIK_STUDENT_ID by lazy {
|
val EDUDZIENNIK_STUDENT_START_ID by lazy {
|
||||||
"""/Students/([\w-_]+?)/""".toRegex()
|
"""/Students/([\w-_]+?)/start""".toRegex()
|
||||||
}
|
}
|
||||||
val EDUDZIENNIK_SUBJECT_ID by lazy {
|
val EDUDZIENNIK_SUBJECT_ID by lazy {
|
||||||
"""/Courses/([\w-_]+?)/""".toRegex()
|
"""/Courses/([\w-_]+?)/""".toRegex()
|
||||||
@ -94,6 +94,9 @@ object Regexes {
|
|||||||
val EDUDZIENNIK_TEACHER_ID by lazy {
|
val EDUDZIENNIK_TEACHER_ID by lazy {
|
||||||
"""/Teachers/([\w-_]+?)/""".toRegex()
|
"""/Teachers/([\w-_]+?)/""".toRegex()
|
||||||
}
|
}
|
||||||
|
val EDUDZIENNIK_GRADE_ID by lazy {
|
||||||
|
"""/Grades/([\w-_]+?)/""".toRegex()
|
||||||
|
}
|
||||||
|
|
||||||
val EDUDZIENNIK_SCHOOL_DETAIL_ID by lazy {
|
val EDUDZIENNIK_SCHOOL_DETAIL_ID by lazy {
|
||||||
"""<a id="School_detail".*?/School/([\w-_]+?)/""".toRegex(RegexOption.DOT_MATCHES_ALL)
|
"""<a id="School_detail".*?/School/([\w-_]+?)/""".toRegex(RegexOption.DOT_MATCHES_ALL)
|
||||||
|
@ -6,7 +6,7 @@ package pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.firstlogin
|
|||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_STUDENT_ID
|
import pl.szczodrzynski.edziennik.data.api.Regexes.EDUDZIENNIK_STUDENT_START_ID
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.DataEdudziennik
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.data.EdudziennikWeb
|
||||||
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb
|
import pl.szczodrzynski.edziennik.data.api.edziennik.edudziennik.login.EdudziennikLoginWeb
|
||||||
@ -31,8 +31,8 @@ class EdudziennikFirstLogin(val data: DataEdudziennik, val onSuccess: () -> Unit
|
|||||||
val doc = Jsoup.parse(text)
|
val doc = Jsoup.parse(text)
|
||||||
val accountName = doc.select("#user_dn").first().text().fixName()
|
val accountName = doc.select("#user_dn").first().text().fixName()
|
||||||
|
|
||||||
doc.select("ul ul > li").first().children().forEach {
|
doc.select("ul ul").first().select("li > a").forEach {
|
||||||
val studentId = EDUDZIENNIK_STUDENT_ID.find(it.attr("href"))?.get(1)
|
val studentId = EDUDZIENNIK_STUDENT_START_ID.find(it.attr("href"))?.get(1)
|
||||||
if (studentId.isNullOrBlank()) return@forEach
|
if (studentId.isNullOrBlank()) return@forEach
|
||||||
|
|
||||||
val studentName = it.text().fixName()
|
val studentName = it.text().fixName()
|
||||||
|
Loading…
Reference in New Issue
Block a user