Moved the fetching task to a separate activity; changed the time attributes in StudIPEvent.kt to strings

This commit is contained in:
denizk0461
2023-04-12 18:58:10 +02:00
parent 4f78eb8373
commit d55a304cec
11 changed files with 131 additions and 29 deletions
@@ -9,7 +9,7 @@ class StudIPParser {
var id = 0
val doc = Jsoup.parse(html)
val newEvents = mutableListOf<StudIPEvent>()
val columns = arrayOf(
val columns = arrayOf( // TODO THIS NEEDS TO BE DYNAMIC!
doc.getElementById("calendar_view_1_column_0"),
doc.getElementById("calendar_view_1_column_1"),
doc.getElementById("calendar_view_1_column_2"),
@@ -24,7 +24,8 @@ class StudIPParser {
val parsedLecturers = entryHeader.substring(delimiter + 1 until entryHeader.length - 1)
val entryInfos = entry.getElementsByTag("dd")[0].text().split(", ", limit = 2)
val timeSlot = Misc.parseTimeslot(entryInfos[0])
// val timeSlot = Misc.parseTimeslot(entryInfos[0])
val timeSlot = entryInfos[0].split(" - ")
val event = StudIPEvent(
id = id,
@@ -32,8 +33,8 @@ class StudIPParser {
lecturer = parsedLecturers,
room = entryInfos[1],
day = index,
timeslotStart = timeSlot.first,
timeslotEnd = timeSlot.second,
timeslotStart = timeSlot[0],
timeslotEnd = timeSlot[1],
)
newEvents.add(event)
id += 1