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
pull/18/head
Jannik 3 years ago
parent 7dfa0fc6c4
commit 6287d4582d
Signed by: Seil0
GPG Key ID: E8459F3723C52C24

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

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close