update spring-boot
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

* add TEST_A and TEST_B courses for testing during summer break
This commit is contained in:
Jannik 2020-08-06 16:31:05 +02:00
parent 7dfa0fc6c4
commit 6287d4582d
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
4 changed files with 1748 additions and 3 deletions

View File

@ -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()

View File

@ -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
}

View File

@ -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)}")
}

File diff suppressed because one or more lines are too long