update spring-boot
* add TEST_A and TEST_B courses for testing during summer break
This commit is contained in:
parent
7dfa0fc6c4
commit
6287d4582d
@ -1,12 +1,12 @@
|
||||
plugins {
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
|
||||
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.72'
|
||||
id 'org.springframework.boot' version '2.3.0.RELEASE'
|
||||
id 'org.springframework.boot' version '2.3.2.RELEASE'
|
||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||
}
|
||||
|
||||
group 'org.mosad'
|
||||
version '1.2.5'
|
||||
version '1.2.6'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
|
@ -49,7 +49,7 @@ class APIController {
|
||||
|
||||
companion object {
|
||||
const val apiVersion = "1.2.0"
|
||||
const val softwareVersion = "1.2.5"
|
||||
const val softwareVersion = "1.2.6"
|
||||
val startTime = System.currentTimeMillis() / 1000
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ package org.mosad.thecitadelofricks.controller
|
||||
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.coroutines.*
|
||||
import org.jsoup.Jsoup
|
||||
import org.mosad.thecitadelofricks.*
|
||||
import org.mosad.thecitadelofricks.hsoparser.CourseListParser
|
||||
import org.mosad.thecitadelofricks.hsoparser.MensaParser
|
||||
@ -61,6 +62,20 @@ class CacheController {
|
||||
* @return timetable of the course (Type: [TimetableCourseWeek])
|
||||
*/
|
||||
fun getTimetable(courseName: String, weekIndex: Int): TimetableCourseWeek = runBlocking {
|
||||
|
||||
// TODO just for testing
|
||||
if (courseName == "TEST_A" || courseName == "TEST_B") {
|
||||
val currentTime = System.currentTimeMillis() / 1000
|
||||
val timetableLink = "https://mosad.xyz"
|
||||
val weekNumberYear = 0
|
||||
|
||||
val htmlFile = File(CacheController::class.java.getResource("/html/Timetable_normal-week.html").path)
|
||||
val htmlDoc = Jsoup.parse(htmlFile,"UTF-8", "https://www.hs-offenburg.de/")
|
||||
val timetableTest = TimetableParser().parseTimeTable(htmlDoc)
|
||||
|
||||
return@runBlocking TimetableCourseWeek(TimetableCourseMeta(currentTime, courseName, weekIndex, weekNumberYear, timetableLink), timetableTest)
|
||||
}
|
||||
|
||||
return@runBlocking timetableList.getOrPut("$courseName-$weekIndex") {
|
||||
val timetableLink = courseList.courses[courseName]
|
||||
?.courseLink
|
||||
@ -127,6 +142,10 @@ class CacheController {
|
||||
courseList = CoursesList(CoursesMeta(System.currentTimeMillis() / 1000, it.size), it)
|
||||
}
|
||||
|
||||
// TODO just for testing
|
||||
courseList.courses["TEST_A"] = Course("TEST_A", "https://mosad.xyz")
|
||||
courseList.courses["TEST_B"] = Course("TEST_B", "https://mosad.xyz")
|
||||
|
||||
logger.info("Updated courses successful at ${Date(courseList.meta.updateTime * 1000)}")
|
||||
}
|
||||
|
||||
|
1726
src/main/resources/html/Timetable_normal-week.html
Normal file
1726
src/main/resources/html/Timetable_normal-week.html
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user