Archived
small adjustments and bugfix; timeslot was always saved into the database longer than would be correct; for example, a course from 08:15 to 09:45 would have been saved as 08:15 to 11:45
This commit is contained in:
@@ -9,7 +9,6 @@ class StudIPParser {
|
||||
fun parse(html: String, insert: (events: List<StudIPEvent>) -> Unit) {
|
||||
var id = 0
|
||||
val doc = Jsoup.parse(html)
|
||||
Log.d("HELLO2", "doc: $doc")
|
||||
val newEvents = mutableListOf<StudIPEvent>()
|
||||
val columns = arrayOf(
|
||||
doc.getElementById("calendar_view_1_column_0"),
|
||||
@@ -18,16 +17,14 @@ class StudIPParser {
|
||||
doc.getElementById("calendar_view_1_column_3"),
|
||||
doc.getElementById("calendar_view_1_column_4"),
|
||||
)
|
||||
Log.d("HELLO2", "days found: ${columns.size}, element 1: ${columns[0]}")
|
||||
columns.forEachIndexed { index, element ->
|
||||
element?.getElementsByClass("schedule_entry")?.forEachIndexed { entryIndex, entry ->
|
||||
Log.d("HELLO2", "element - $entryIndex - found: $entry")
|
||||
val entryHeader = entry.getElementsByTag("dt")[0].text()
|
||||
val delimiter = entryHeader.lastIndexOf('(')
|
||||
val parsedTitle = entryHeader.substring(0 until delimiter)
|
||||
val parsedLecturers = entryHeader.substring(delimiter + 1 until entryHeader.length - 1)
|
||||
|
||||
val entryInfos = entry.getElementsByTag("dd")[0].text().split(", ")
|
||||
val entryInfos = entry.getElementsByTag("dd")[0].text().split(", ", limit = 2)
|
||||
val timeSlot = DummyData.parseTimeslot(entryInfos[0])
|
||||
|
||||
val event = StudIPEvent(
|
||||
@@ -41,7 +38,6 @@ class StudIPParser {
|
||||
)
|
||||
newEvents.add(event)
|
||||
id += 1
|
||||
Log.d("HELLO2", event.toString())
|
||||
}
|
||||
}
|
||||
insert(newEvents)
|
||||
|
||||
Reference in New Issue
Block a user