Started implementation of event update sheet

This commit is contained in:
denizk0461
2023-04-24 15:43:42 +02:00
parent a53232a814
commit 9b6e267cb0
24 changed files with 410 additions and 53 deletions
@@ -3,6 +3,18 @@ package com.denizk0461.studip.data
/**
* Miscellaneous functions and variables that don't belong into any specific class.
*/
/**
* Converts a time stamp string to its numeric value in minutes.
* Example: 13:20. (20 minutes) + (13 hours * 60 minutes) = 800 minutes.
*
* @return minute value of the string
*/
fun String.parseToMinutes(): Int {
val parts = split(":")
return (parts[0].toInt() * 60) + parts[1].toInt()
}
object Misc {
// private val timeslotAcademicQuarter = mapOf(
@@ -76,6 +76,9 @@ class StudIPParser {
// Retrieve the time slot and split it into start and end time stamps
val timeSlot = entryInfo[0].split(" - ")
// Time the event starts at
val eventStart = timeSlot[0]
// Construct the newly scraped Stud.IP event
val event = StudIPEvent(
id = id,
@@ -83,8 +86,9 @@ class StudIPParser {
lecturer = parsedLecturers,
room = entryInfo[1],
day = index,
timeslotStart = timeSlot[0],
timeslotStart = eventStart,
timeslotEnd = timeSlot[1],
timeslotId = eventStart.parseToMinutes(),
)
// Add the new element to the temporary list