Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
a13203c477
|
|||
2bb6bc6534 | |||
d0d5e4b6d1
|
|||
16cb89ca38
|
|||
b428840df7
|
|||
4ca79e6540
|
@ -7,8 +7,3 @@ steps:
|
||||
commands:
|
||||
- gradle test
|
||||
|
||||
- name: test-jdk8
|
||||
image: gradle:jdk8
|
||||
commands:
|
||||
- gradle test
|
||||
|
||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -35,6 +35,7 @@ captures/
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
.idea/
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
@ -55,6 +56,9 @@ freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# KDE
|
||||
.directory
|
||||
.idea/
|
||||
|
||||
# tcor
|
||||
tcor/
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
[](https://drone.mosad.xyz/Seil0/TheCitadelofRicks)
|
||||
[](https://git.mosad.xyz/Seil0/TheCitadelofRicks/releases)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
# TheCitadelofRicks
|
||||
|
||||
|
12
build.gradle
12
build.gradle
@ -1,7 +1,7 @@
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.60'
|
||||
ext.spring_boot_version = '2.1.10.RELEASE'
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.spring_boot_version = '2.1.11.RELEASE'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
@ -33,7 +33,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3"
|
||||
implementation "org.jsoup:jsoup:1.12.1"
|
||||
implementation "org.springframework.boot:spring-boot-starter-web"
|
||||
implementation "com.google.code.gson:gson:2.8.6"
|
||||
@ -42,11 +42,11 @@ dependencies {
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.jvmTarget = "11"
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
kotlinOptions.jvmTarget = "11"
|
||||
}
|
||||
|
||||
group 'org.mosad'
|
||||
version '1.2.0'
|
||||
version '1.2.1'
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -48,7 +48,7 @@ class APIController {
|
||||
|
||||
companion object {
|
||||
const val apiVersion = "1.1.4"
|
||||
const val softwareVersion = "1.2.0"
|
||||
const val softwareVersion = "1.2.1"
|
||||
val startTime = System.currentTimeMillis() / 1000
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ class APIController {
|
||||
CacheController()
|
||||
}
|
||||
|
||||
// TODO remove this with API version 1.2.0
|
||||
// TODO remove this with API version 2.0.0
|
||||
@Deprecated("courses is replaced by courseList", replaceWith = ReplaceWith("courseList()"))
|
||||
@RequestMapping("/courses")
|
||||
fun courses(): CourseList {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -116,7 +116,7 @@ class CacheController {
|
||||
}
|
||||
|
||||
/**
|
||||
* get every explicit lesson in a week
|
||||
* get every lesson of a subject in a week
|
||||
* @param courseName the name of the course to be requested
|
||||
* @param lessonSubject the lesson subject to be requested
|
||||
* @param weekIndex request week number (current week = 0)
|
||||
@ -128,14 +128,7 @@ class CacheController {
|
||||
// get all lessons from the weeks timetable
|
||||
val flatMap = getTimetable(courseName, weekIndex).timetable.days.flatMap { it.timeslots.asIterable() }
|
||||
flatMap.forEach {
|
||||
// TODO Java 11
|
||||
//it.stream().filter { x -> x.lessonSubject.contains(lessonSubject) }.findAny().ifPresent { x -> println("${x.lessonSubject}, ${x.lessonTeacher}") }
|
||||
|
||||
it.forEach { lesson ->
|
||||
if(lesson.lessonSubject.contains(lessonSubject)) {
|
||||
lessonList.add(lesson)
|
||||
}
|
||||
}
|
||||
it.stream().filter { x -> x.lessonSubject.contains(lessonSubject) }.findAny().ifPresent { x -> lessonList.add(x) }
|
||||
}
|
||||
|
||||
return lessonList
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -35,8 +35,8 @@ class StartupController {
|
||||
private val logger: Logger = LoggerFactory.getLogger(CacheController::class.java)
|
||||
|
||||
companion object {
|
||||
val userHome: String = System.getProperty("user.home")
|
||||
val tcorHome = "$userHome/.tcor"
|
||||
val userHome: String = System.getProperty("user.dir")
|
||||
val tcorHome = "$userHome/tcor"
|
||||
val dirTcorHome = File(tcorHome)
|
||||
val dirTcorCache = File("$tcorHome/cache")
|
||||
val fileConfig = File("$tcorHome/config.xml")
|
||||
@ -66,7 +66,7 @@ class StartupController {
|
||||
createConfig()
|
||||
}
|
||||
|
||||
// TODO read cached timetable files, as they are not initially cached
|
||||
// read cached timetable files, as they are not initially cached
|
||||
readCachedTimetables()
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -56,18 +56,11 @@ class StatusController {
|
||||
* if a timetable is requested update the request counter
|
||||
*/
|
||||
fun updateTimetableRequests(courseName: String) {
|
||||
when (timetableRequests.stream().filter { x -> x.courseName == courseName }.findAny().orElse(null)) {
|
||||
null -> timetableRequests.add(TimetableCounter(courseName, 0))
|
||||
}
|
||||
timetableRequests.stream().filter { x -> x.courseName == courseName }.findFirst()
|
||||
.ifPresent { x -> x.requests++ }
|
||||
|
||||
// TODO Java 11
|
||||
// timetableRequests.stream().filter { it.courseName == courseName }.findFirst().ifPresentOrElse({
|
||||
// it.requests++
|
||||
// }, {
|
||||
//
|
||||
// })
|
||||
timetableRequests.stream().filter { it.courseName == courseName }.findFirst().ifPresentOrElse({
|
||||
it.requests++
|
||||
}, {
|
||||
timetableRequests.add(TimetableCounter(courseName, 1))
|
||||
})
|
||||
}
|
||||
|
||||
fun getTotalRequests(): Int {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* TheCitadelofRicks
|
||||
*
|
||||
* Copyright 2019 <seil0@mosad.xyz>
|
||||
* Copyright 2019-2020 <seil0@mosad.xyz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
Reference in New Issue
Block a user