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
@@ -1,5 +1,6 @@
package com.denizk0461.studip.model
import android.util.Log
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
@@ -11,15 +12,26 @@ data class StudIPEvent(
val lecturer: String, // the lecturer(s)
val room: String, // the room the event takes place in
val day: Int, // 0 = Monday, 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday
val timeslotStart: Int, // 0 = 08:15, 1 = 10:15, 2 = 12:15, 3 = 14:15, 4 = 16:15, 5 = 18:15
val timeslots: Int, // the amount of timeslots the course takes place over (1 timeslot = 90min)
val timeslotStart: Int, // 1 = 08:15, 2 = 10:15, 3 = 12:15, 4 = 14:15, 5 = 16:15, 6 = 18:15
val timeslotEnd: Int, // 1 = 09:45 etc.
) {
@Ignore private val timeSlotStartTimes: List<String> = listOf("08:15", "10:15", "12:15", "14:15", "16:15", "18:15")
@Ignore private val timeSlotEndTimes: List<String> = listOf("09:45", "11:45", "13:45", "15:45", "17:45", "19:45")
// constructor(
// val title: String,
// val lecturer: String,
// val room: String,
// val day: Int,
// val
// ) : this(title, lecturer, room, day, 1, 1)
@Ignore val timeslot: String =
"${timeSlotStartTimes[timeslotStart]} ${timeSlotEndTimes[timeslotStart + timeslots - 1]}"
@Ignore private val timeSlotStartTimes: List<String> = listOf("06:15", "08:15", "10:15", "12:15", "14:15", "16:15", "18:15")
@Ignore private val timeSlotEndTimes: List<String> = listOf("07:45", "09:45", "11:45", "13:45", "15:45", "17:45", "19:45")
fun timeslot(): String {
Log.d("HELLO3", title)
Log.d("HELLO3", "s $timeslotStart st $timeslotEnd")
return "${timeSlotStartTimes[timeslotStart]} ${timeSlotEndTimes[timeslotEnd]}"
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -32,7 +44,6 @@ data class StudIPEvent(
return true
}
override fun hashCode(): Int {
var result = id
result = 31 * result + title.hashCode()
@@ -40,10 +51,9 @@ data class StudIPEvent(
result = 31 * result + room.hashCode()
result = 31 * result + day
result = 31 * result + timeslotStart
result = 31 * result + timeslots
result = 31 * result + timeslotEnd
result = 31 * result + timeSlotStartTimes.hashCode()
result = 31 * result + timeSlotEndTimes.hashCode()
result = 31 * result + timeslot.hashCode()
return result
}
}