PARSING HTML WORKS AND IT GETS SAVED TO THE DATABASE WOOO

This commit is contained in:
denizk0461
2023-04-10 20:54:15 +02:00
parent 97bc2b1068
commit cab50b5f2d
13 changed files with 161 additions and 58 deletions
@@ -13,4 +13,45 @@ object DummyData {
StudIPEvent(6, "Gesellschaft und Raum", "Lossau, Mossig", "GW2 B1820", 3, 1, 1),
StudIPEvent(7, "Gesellschaft und Raum2", "Lossau, Mossig", "GW2 B1820", 4, 4, 2),
)
val timeslotStartMap: Map<String, Int> = mapOf(
"6:00" to 0,
"6:15" to 0,
"8:00" to 1,
"8:15" to 1,
"10:00" to 2,
"10:15" to 2,
"12:00" to 3,
"12:15" to 3,
"14:00" to 4,
"14:15" to 4,
"16:00" to 5,
"16:15" to 5,
"18:00" to 6,
"18:15" to 6,
)
val timeslotEndMap: Map<String, Int> = mapOf(
"8:00" to 0,
"7:45" to 0,
"10:00" to 1,
"9:45" to 1,
"12:00" to 2,
"11:45" to 2,
"14:00" to 3,
"13:45" to 3,
"16:00" to 4,
"15:45" to 4,
"18:00" to 5,
"17:45" to 5,
"20:00" to 6,
"19:45" to 6,
)
fun parseTimeslot(time: String): Pair<Int, Int> {
val splitTime = time.split(" - ")
val start = timeslotStartMap[splitTime[0]] ?: 0
val length = (timeslotEndMap[splitTime[1]] ?: 0)
return Pair(start, length)
}
}