mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[API/Mobidziennik] Fix web attendance without lesson topic.
This commit is contained in:
parent
e068f1944f
commit
c8c758958d
@ -84,7 +84,7 @@ object Regexes {
|
||||
"""<span>([0-9:]+) - .+? (.+?)</span></a>""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
val MOBIDZIENNIK_ATTENDANCE_LESSON by lazy {
|
||||
"""<strong>(.+?) - (.*?)</strong>.+?<small>.+?\((.+?), .+?(.+?)\)""".toRegex(DOT_MATCHES_ALL)
|
||||
"""<strong>(.+?)</strong>\s*<small>\s*\((.+?),\s*(.+?)\)""".toRegex(DOT_MATCHES_ALL)
|
||||
}
|
||||
|
||||
val MOBIDZIENNIK_HOMEWORK_ROW by lazy {
|
||||
|
@ -115,12 +115,12 @@ class MobidziennikWebAttendance(override val data: DataMobidziennik,
|
||||
val startTime = Time.fromH_m(range[1])
|
||||
|
||||
range[2].split(" / ").mapNotNull { Regexes.MOBIDZIENNIK_ATTENDANCE_LESSON.find(it) }.forEachIndexed { index, lesson ->
|
||||
val topic = lesson[2]
|
||||
if (topic.startsWith("Lekcja odwołana: ") || entry.isEmpty())
|
||||
val topic = lesson[1].substringAfter(" - ", missingDelimiterValue = "").takeIf { it.isNotBlank() }
|
||||
if (topic?.startsWith("Lekcja odwołana: ") == true || entry.isEmpty())
|
||||
return@forEachIndexed
|
||||
val subjectName = lesson[1]
|
||||
val subjectName = lesson[1].substringBefore(" - ")
|
||||
//val team = lesson[3]
|
||||
val teacherName = lesson[4].fixName()
|
||||
val teacherName = lesson[3].fixName()
|
||||
|
||||
val teacherId = data.teacherList.singleOrNull { it.fullNameLastFirst == teacherName }?.id ?: -1
|
||||
val subjectId = data.subjectList.singleOrNull { it.longName == subjectName }?.id ?: -1
|
||||
|
Loading…
Reference in New Issue
Block a user