Archived
Added data type EventTask.kt for the task fragment; added timetableId to StudIPEvent.kt to assign events with a specific timetable, for a future implementation of being able to store multiple timetables simultaneously; database scheme will now be exported to allow for automatic migrations
This commit is contained in:
@@ -20,6 +20,10 @@ android {
|
|||||||
buildConfigField("long", "BUILD_TIME_MILLIS", "${System.currentTimeMillis()}L")
|
buildConfigField("long", "BUILD_TIME_MILLIS", "${System.currentTimeMillis()}L")
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
javaCompileOptions.annotationProcessorOptions {
|
||||||
|
arguments += mapOf("room.schemaLocation" to "${projectDir}/schemas")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 20,
|
||||||
|
"identityHash": "afd2e2f213531096baf1c5656da7f0b9",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "studip_events",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`eventId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `title` TEXT NOT NULL, `lecturer` TEXT NOT NULL, `room` TEXT NOT NULL, `day` INTEGER NOT NULL, `timeslotStart` TEXT NOT NULL, `timeslotEnd` TEXT NOT NULL, `timeslotId` INTEGER NOT NULL, `colour` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "eventId",
|
||||||
|
"columnName": "eventId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "title",
|
||||||
|
"columnName": "title",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lecturer",
|
||||||
|
"columnName": "lecturer",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "room",
|
||||||
|
"columnName": "room",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "day",
|
||||||
|
"columnName": "day",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotStart",
|
||||||
|
"columnName": "timeslotStart",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotEnd",
|
||||||
|
"columnName": "timeslotEnd",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotId",
|
||||||
|
"columnName": "timeslotId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "colour",
|
||||||
|
"columnName": "colour",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"eventId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_date",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `date` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "date",
|
||||||
|
"columnName": "date",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_canteen",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `canteen` TEXT NOT NULL, `openingHours` TEXT NOT NULL, `news` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "canteen",
|
||||||
|
"columnName": "canteen",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "openingHours",
|
||||||
|
"columnName": "openingHours",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "news",
|
||||||
|
"columnName": "news",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_category",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `dateId` INTEGER NOT NULL, `canteenId` INTEGER NOT NULL, `category` TEXT NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`dateId`) REFERENCES `offer_date`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`canteenId`) REFERENCES `offer_canteen`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dateId",
|
||||||
|
"columnName": "dateId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "canteenId",
|
||||||
|
"columnName": "canteenId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "category",
|
||||||
|
"columnName": "category",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "offer_date",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"dateId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "offer_canteen",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"canteenId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_item",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`itemId` INTEGER NOT NULL, `categoryId` INTEGER NOT NULL, `title` TEXT NOT NULL, `price` TEXT NOT NULL, `dietary_preferences` TEXT NOT NULL, `allergens` TEXT NOT NULL, PRIMARY KEY(`itemId`), FOREIGN KEY(`categoryId`) REFERENCES `offer_category`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "itemId",
|
||||||
|
"columnName": "itemId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "categoryId",
|
||||||
|
"columnName": "categoryId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "title",
|
||||||
|
"columnName": "title",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "price",
|
||||||
|
"columnName": "price",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dietaryPreferences",
|
||||||
|
"columnName": "dietary_preferences",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "allergens",
|
||||||
|
"columnName": "allergens",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"itemId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "offer_category",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"categoryId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'afd2e2f213531096baf1c5656da7f0b9')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,338 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 21,
|
||||||
|
"identityHash": "4ac175b58eab4b387bd1ceb98f39a913",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "studip_events",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`eventId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timetableId` INTEGER NOT NULL DEFAULT 0, `title` TEXT NOT NULL, `lecturer` TEXT NOT NULL, `room` TEXT NOT NULL, `day` INTEGER NOT NULL, `timeslotStart` TEXT NOT NULL, `timeslotEnd` TEXT NOT NULL, `timeslotId` INTEGER NOT NULL, `colour` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "eventId",
|
||||||
|
"columnName": "eventId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timetableId",
|
||||||
|
"columnName": "timetableId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true,
|
||||||
|
"defaultValue": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "title",
|
||||||
|
"columnName": "title",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lecturer",
|
||||||
|
"columnName": "lecturer",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "room",
|
||||||
|
"columnName": "room",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "day",
|
||||||
|
"columnName": "day",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotStart",
|
||||||
|
"columnName": "timeslotStart",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotEnd",
|
||||||
|
"columnName": "timeslotEnd",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "timeslotId",
|
||||||
|
"columnName": "timeslotId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "colour",
|
||||||
|
"columnName": "colour",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"eventId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_date",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `date` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "date",
|
||||||
|
"columnName": "date",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_canteen",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `canteen` TEXT NOT NULL, `openingHours` TEXT NOT NULL, `news` TEXT NOT NULL, PRIMARY KEY(`id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "canteen",
|
||||||
|
"columnName": "canteen",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "openingHours",
|
||||||
|
"columnName": "openingHours",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "news",
|
||||||
|
"columnName": "news",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_category",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `dateId` INTEGER NOT NULL, `canteenId` INTEGER NOT NULL, `category` TEXT NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`dateId`) REFERENCES `offer_date`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`canteenId`) REFERENCES `offer_canteen`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dateId",
|
||||||
|
"columnName": "dateId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "canteenId",
|
||||||
|
"columnName": "canteenId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "category",
|
||||||
|
"columnName": "category",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "offer_date",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"dateId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "offer_canteen",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"canteenId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "offer_item",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`itemId` INTEGER NOT NULL, `categoryId` INTEGER NOT NULL, `title` TEXT NOT NULL, `price` TEXT NOT NULL, `dietary_preferences` TEXT NOT NULL, `allergens` TEXT NOT NULL, PRIMARY KEY(`itemId`), FOREIGN KEY(`categoryId`) REFERENCES `offer_category`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "itemId",
|
||||||
|
"columnName": "itemId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "categoryId",
|
||||||
|
"columnName": "categoryId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "title",
|
||||||
|
"columnName": "title",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "price",
|
||||||
|
"columnName": "price",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dietaryPreferences",
|
||||||
|
"columnName": "dietary_preferences",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "allergens",
|
||||||
|
"columnName": "allergens",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": false,
|
||||||
|
"columnNames": [
|
||||||
|
"itemId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "offer_category",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"categoryId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_tasks",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`taskId` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `eventId` INTEGER NOT NULL, `dueDate` INTEGER NOT NULL, `title` TEXT NOT NULL, `notes` TEXT NOT NULL, `room` TEXT NOT NULL, FOREIGN KEY(`eventId`) REFERENCES `studip_events`(`eventId`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "taskId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventId",
|
||||||
|
"columnName": "eventId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dueDate",
|
||||||
|
"columnName": "dueDate",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "title",
|
||||||
|
"columnName": "title",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "notes",
|
||||||
|
"columnName": "notes",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "room",
|
||||||
|
"columnName": "room",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"taskId"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "studip_events",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "NO ACTION",
|
||||||
|
"columns": [
|
||||||
|
"eventId"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"eventId"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '4ac175b58eab4b387bd1ceb98f39a913')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -96,6 +96,7 @@ class StudIPParser(application: Application) {
|
|||||||
|
|
||||||
// Construct the newly scraped Stud.IP event
|
// Construct the newly scraped Stud.IP event
|
||||||
val event = StudIPEvent(
|
val event = StudIPEvent(
|
||||||
|
timetableId = 0, // TODO
|
||||||
title = parsedTitle,
|
title = parsedTitle,
|
||||||
lecturer = parsedLecturers,
|
lecturer = parsedLecturers,
|
||||||
room = entryInfo.getOrQuestionMark(1),
|
room = entryInfo.getOrQuestionMark(1),
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.denizk0461.weserplaner.db
|
package com.denizk0461.weserplaner.db
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.room.AutoMigration
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
@@ -18,8 +19,13 @@ import com.denizk0461.weserplaner.model.*
|
|||||||
OfferCanteen::class,
|
OfferCanteen::class,
|
||||||
OfferCategory::class,
|
OfferCategory::class,
|
||||||
OfferItem::class,
|
OfferItem::class,
|
||||||
|
EventTask::class,
|
||||||
|
],
|
||||||
|
version = 21,
|
||||||
|
exportSchema = true,
|
||||||
|
autoMigrations = [
|
||||||
|
AutoMigration(from = 20, to = 21),
|
||||||
],
|
],
|
||||||
version = 20,
|
|
||||||
)
|
)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
|
||||||
@@ -50,7 +56,11 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
context.applicationContext,
|
context.applicationContext,
|
||||||
AppDatabase::class.java,
|
AppDatabase::class.java,
|
||||||
"event_db",
|
"event_db",
|
||||||
).addMigrations(migrationAddNewsToOfferCanteen_19_20)
|
).addMigrations(
|
||||||
|
migrationAddNewsToOfferCanteen_19_20,
|
||||||
|
// migrationAddTimetableId_20_21,
|
||||||
|
// migrationAddEventTask_20_21,
|
||||||
|
)
|
||||||
// .fallbackToDestructiveMigration()
|
// .fallbackToDestructiveMigration()
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class EventPageFragment : AppFragment<RecyclerViewBinding>(), StudIPEventItemAda
|
|||||||
eventAdapter.setNewData(events.ifEmpty { listOf(
|
eventAdapter.setNewData(events.ifEmpty { listOf(
|
||||||
// Use an event with eventId = -1 to denote that there are no events for this day
|
// Use an event with eventId = -1 to denote that there are no events for this day
|
||||||
StudIPEvent(
|
StudIPEvent(
|
||||||
|
-1,
|
||||||
-1,
|
-1,
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.denizk0461.weserplaner.model
|
||||||
|
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.ForeignKey
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
@Entity(
|
||||||
|
tableName = "event_tasks",
|
||||||
|
foreignKeys = [
|
||||||
|
ForeignKey(
|
||||||
|
StudIPEvent::class,
|
||||||
|
["eventId"],
|
||||||
|
["eventId"],
|
||||||
|
ForeignKey.CASCADE,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
data class EventTask(
|
||||||
|
@PrimaryKey(autoGenerate = true) val taskId: Int = 0,
|
||||||
|
val eventId: Int,
|
||||||
|
val dueDate: Int,
|
||||||
|
val title: String,
|
||||||
|
val notes: String,
|
||||||
|
val room: String,
|
||||||
|
)
|
||||||
@@ -2,6 +2,7 @@ package com.denizk0461.weserplaner.model
|
|||||||
|
|
||||||
import android.os.Parcel
|
import android.os.Parcel
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ import androidx.room.PrimaryKey
|
|||||||
* Entity for storing entries of the user's Stud.IP schedule. Registered in the app database.
|
* Entity for storing entries of the user's Stud.IP schedule. Registered in the app database.
|
||||||
*
|
*
|
||||||
* @param eventId primary key that uniquely identifies the entry
|
* @param eventId primary key that uniquely identifies the entry
|
||||||
|
* @param timetableId identifier to assign the event to a timetable
|
||||||
* @param title title of the event
|
* @param title title of the event
|
||||||
* @param lecturer lecturer(s) organising the event
|
* @param lecturer lecturer(s) organising the event
|
||||||
* @param room room the event takes place in
|
* @param room room the event takes place in
|
||||||
@@ -21,6 +23,7 @@ import androidx.room.PrimaryKey
|
|||||||
@Entity(tableName = "studip_events")
|
@Entity(tableName = "studip_events")
|
||||||
data class StudIPEvent(
|
data class StudIPEvent(
|
||||||
@PrimaryKey(autoGenerate = true) val eventId: Int = 0,
|
@PrimaryKey(autoGenerate = true) val eventId: Int = 0,
|
||||||
|
@ColumnInfo(defaultValue = "0") val timetableId: Int,
|
||||||
val title: String,
|
val title: String,
|
||||||
val lecturer: String,
|
val lecturer: String,
|
||||||
val room: String,
|
val room: String,
|
||||||
@@ -30,6 +33,7 @@ data class StudIPEvent(
|
|||||||
val timeslotId: Int,
|
val timeslotId: Int,
|
||||||
val colour: Int = 0,
|
val colour: Int = 0,
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse timeslotStart and timeslotEnd into an easily readable string in the following format:
|
* Parse timeslotStart and timeslotEnd into an easily readable string in the following format:
|
||||||
* 12:15 – 13:45
|
* 12:15 – 13:45
|
||||||
@@ -45,6 +49,7 @@ data class StudIPEvent(
|
|||||||
other as StudIPEvent
|
other as StudIPEvent
|
||||||
|
|
||||||
if (eventId != other.eventId) return false
|
if (eventId != other.eventId) return false
|
||||||
|
if (timetableId != other.timetableId) return false
|
||||||
if (title != other.title) return false
|
if (title != other.title) return false
|
||||||
if (lecturer != other.lecturer) return false
|
if (lecturer != other.lecturer) return false
|
||||||
if (room != other.room) return false
|
if (room != other.room) return false
|
||||||
@@ -59,6 +64,7 @@ data class StudIPEvent(
|
|||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var result = eventId
|
var result = eventId
|
||||||
|
result = 31 * result + timetableId
|
||||||
result = 31 * result + title.hashCode()
|
result = 31 * result + title.hashCode()
|
||||||
result = 31 * result + lecturer.hashCode()
|
result = 31 * result + lecturer.hashCode()
|
||||||
result = 31 * result + room.hashCode()
|
result = 31 * result + room.hashCode()
|
||||||
@@ -71,6 +77,7 @@ data class StudIPEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(source: Parcel) : this(
|
constructor(source: Parcel) : this(
|
||||||
|
source.readInt(),
|
||||||
source.readInt(),
|
source.readInt(),
|
||||||
source.readString() ?: "",
|
source.readString() ?: "",
|
||||||
source.readString() ?: "",
|
source.readString() ?: "",
|
||||||
@@ -86,6 +93,7 @@ data class StudIPEvent(
|
|||||||
|
|
||||||
override fun writeToParcel(dest: Parcel, flags: Int): Unit = with(dest) {
|
override fun writeToParcel(dest: Parcel, flags: Int): Unit = with(dest) {
|
||||||
writeInt(eventId)
|
writeInt(eventId)
|
||||||
|
writeInt(timetableId)
|
||||||
writeString(title)
|
writeString(title)
|
||||||
writeString(lecturer)
|
writeString(lecturer)
|
||||||
writeString(room)
|
writeString(room)
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update) {
|
|||||||
// construct new StudIPEvent from the data the user may have edited
|
// construct new StudIPEvent from the data the user may have edited
|
||||||
StudIPEvent(
|
StudIPEvent(
|
||||||
eventId = event.eventId,
|
eventId = event.eventId,
|
||||||
|
timetableId = event.timetableId,
|
||||||
title = binding.editTextTitle.text.toString().trim(),
|
title = binding.editTextTitle.text.toString().trim(),
|
||||||
lecturer = binding.editTextLecturers.text.toString().trim(),
|
lecturer = binding.editTextLecturers.text.toString().trim(),
|
||||||
room = binding.editTextRoom.text.toString().trim(),
|
room = binding.editTextRoom.text.toString().trim(),
|
||||||
@@ -204,6 +205,7 @@ class ScheduleUpdateSheet : AppSheet(R.layout.sheet_schedule_update) {
|
|||||||
viewModel.insert(
|
viewModel.insert(
|
||||||
// construct new StudIPEvent from the data the user may have edited
|
// construct new StudIPEvent from the data the user may have edited
|
||||||
StudIPEvent(
|
StudIPEvent(
|
||||||
|
timetableId = 0, // TODO current timetable
|
||||||
title = binding.editTextTitle.text.toString().trim(),
|
title = binding.editTextTitle.text.toString().trim(),
|
||||||
lecturer = binding.editTextLecturers.text.toString().trim(),
|
lecturer = binding.editTextLecturers.text.toString().trim(),
|
||||||
room = binding.editTextRoom.text.toString().trim(),
|
room = binding.editTextRoom.text.toString().trim(),
|
||||||
|
|||||||
@@ -240,6 +240,10 @@
|
|||||||
|
|
||||||
<string name="settings_licences_title">Siehe Lizenzen</string>
|
<string name="settings_licences_title">Siehe Lizenzen</string>
|
||||||
<string name="settings_licences_subtitle">Ressourcen, die diese App möglich gemacht haben</string>
|
<string name="settings_licences_subtitle">Ressourcen, die diese App möglich gemacht haben</string>
|
||||||
|
<string name="settings_unlocked_experiments">Experimentelle Einstellungen werden angezeigt.</string>
|
||||||
|
<string name="settings_hide_experiments">Experimentelle Einstellungen wurden ausgeblendet.</string>
|
||||||
|
|
||||||
|
<string name="sheet_cheat_header">Cheatcodes</string>
|
||||||
|
|
||||||
<string name="settings_app_version">App-Version</string>
|
<string name="settings_app_version">App-Version</string>
|
||||||
|
|
||||||
|
|||||||
@@ -245,10 +245,10 @@
|
|||||||
|
|
||||||
<string name="settings_licences_title">View licences</string>
|
<string name="settings_licences_title">View licences</string>
|
||||||
<string name="settings_licences_subtitle">Resources that made this app possible</string>
|
<string name="settings_licences_subtitle">Resources that made this app possible</string>
|
||||||
<string name="settings_unlocked_experiments" translatable="false">Experimental settings have been unlocked.</string>
|
<string name="settings_unlocked_experiments">Experimental settings have been unlocked.</string>
|
||||||
<string name="settings_hide_experiments" translatable="false">Experimental settings have been hidden.</string>
|
<string name="settings_hide_experiments">Experimental settings have been hidden.</string>
|
||||||
|
|
||||||
<string name="sheet_cheat_header" translatable="false">Cheat Codes</string>
|
<string name="sheet_cheat_header">Cheat Codes</string>
|
||||||
|
|
||||||
<string name="settings_app_version">App Version</string>
|
<string name="settings_app_version">App Version</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user