Archived
Added database persistence ability
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package com.denizk0461.studip.data
|
||||
|
||||
import com.denizk0461.studip.db.EventRepository
|
||||
|
||||
object Dependencies {
|
||||
lateinit var repo: EventRepository
|
||||
}
|
||||
@@ -3,12 +3,12 @@ package com.denizk0461.studip.data
|
||||
object DummyData {
|
||||
|
||||
val events: Array<StudIPEvent> = arrayOf(
|
||||
StudIPEvent("Literatures", arrayOf("Nittel"), "MZH 1380/1400", 0, 3, 1),
|
||||
StudIPEvent("Linguistics", arrayOf("Du Bois"), "SFG 1020", 1, 1, 1),
|
||||
StudIPEvent("System Erde", arrayOf("Zolitschka", "Labuhn-Deroubaix"), "GW2 B1410", 1, 3, 1),
|
||||
StudIPEvent("Key Moments", arrayOf("Esders-Angermund"), "GW2 B2890", 2, 2, 1),
|
||||
StudIPEvent("ULS-1", arrayOf("Herrmann"), "GW2 B2890", 2, 3, 1),
|
||||
StudIPEvent("Gesellschaft und Raum", arrayOf("Lossau", "Mossig"), "GW2 B1820", 3, 1, 1),
|
||||
StudIPEvent("Gesellschaft und Raum2", arrayOf("Lossau", "Mossig"), "GW2 B1820", 4, 4, 2),
|
||||
StudIPEvent(1, "Literatures", "Nittel", "MZH 1380/1400", 0, 3, 1),
|
||||
StudIPEvent(2, "Linguistics", "Du Bois", "SFG 1020", 1, 1, 1),
|
||||
StudIPEvent(3, "System Erde", "Zolitschka, Labuhn-Deroubaix", "GW2 B1410", 1, 3, 1),
|
||||
StudIPEvent(4, "Key Moments", "Esders-Angermund", "GW2 B2890", 2, 2, 1),
|
||||
StudIPEvent(5, "ULS-1", "Herrmann", "GW2 B2890", 2, 3, 1),
|
||||
StudIPEvent(6, "Gesellschaft und Raum", "Lossau, Mossig", "GW2 B1820", 3, 1, 1),
|
||||
StudIPEvent(7, "Gesellschaft und Raum2", "Lossau, Mossig", "GW2 B1820", 4, 4, 2),
|
||||
)
|
||||
}
|
||||
@@ -1,18 +1,24 @@
|
||||
package com.denizk0461.studip.data
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "events")
|
||||
data class StudIPEvent(
|
||||
@PrimaryKey val id: Int,
|
||||
val title: String, // the name of the event
|
||||
val lecturer: Array<String>, // the lecturer(s)
|
||||
val room: String, // the room the event takes place in; assumes that the room doesn't change
|
||||
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)
|
||||
) {
|
||||
|
||||
private val timeSlotStartTimes: List<String> = listOf("08:15", "10:15", "12:15", "14:15", "16:15", "18:15")
|
||||
private val timeSlotEndTimes: List<String> = listOf("09:45", "11:45", "13:45", "15:45", "17:45", "19:45")
|
||||
@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")
|
||||
|
||||
val timeslot: String =
|
||||
@Ignore val timeslot: String =
|
||||
"${timeSlotStartTimes[timeslotStart]} – ${timeSlotEndTimes[timeslotStart + timeslots - 1]}"
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@@ -26,9 +32,18 @@ data class StudIPEvent(
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = title.hashCode()
|
||||
result = 31 * result + lecturer.contentHashCode()
|
||||
var result = id
|
||||
result = 31 * result + title.hashCode()
|
||||
result = 31 * result + lecturer.hashCode()
|
||||
result = 31 * result + room.hashCode()
|
||||
result = 31 * result + day
|
||||
result = 31 * result + timeslotStart
|
||||
result = 31 * result + timeslots
|
||||
result = 31 * result + timeSlotStartTimes.hashCode()
|
||||
result = 31 * result + timeSlotEndTimes.hashCode()
|
||||
result = 31 * result + timeslot.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user