Browse Source

fix courseList sorting

closes #15
pull/18/head
Jannik 2 years ago
parent
commit
3f10c8afaa
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
  1. 2
      src/main/kotlin/org/mosad/thecitadelofricks/DataTypes.kt
  2. 4
      src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt

2
src/main/kotlin/org/mosad/thecitadelofricks/DataTypes.kt

@ -31,7 +31,7 @@ data class Course(val courseName: String, val courseLink: String)
data class CoursesMeta(val updateTime: Long = 0, val totalCourses: Int = 0)
data class CoursesList(val meta: CoursesMeta = CoursesMeta(), val courses: HashMap<String, Course> = HashMap())
data class CoursesList(val meta: CoursesMeta = CoursesMeta(), val courses: SortedMap<String, Course>)
data class CoursesListRet(val meta: CoursesMeta = CoursesMeta(), val courses: ArrayList<Course> = ArrayList())
// data classes for the Mensa part

4
src/main/kotlin/org/mosad/thecitadelofricks/controller/CacheController.kt

@ -49,7 +49,7 @@ class CacheController {
companion object{
private val logger: Logger = LoggerFactory.getLogger(CacheController::class.java)
var courseList = CoursesList()
var courseList = CoursesList(CoursesMeta(), sortedMapOf())
var mensaMenu = MensaMenu(MensaMeta(0,""), MensaWeek(), MensaWeek())
var timetableList = HashMap<String, TimetableCourseWeek>() // this list contains all timetables
@ -137,7 +137,7 @@ class CacheController {
*/
private fun asyncUpdateCourseList() = GlobalScope.launch {
CourseListParser().getCourseLinks(StartupController.courseListURL)?.let {
courseList = CoursesList(CoursesMeta(System.currentTimeMillis() / 1000, it.size), it)
courseList = CoursesList(CoursesMeta(System.currentTimeMillis() / 1000, it.size), it.toSortedMap())
}
// TODO just for testing

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