From c6ac19bfae49235bb1d314c3bfc7f5a1ecbd4074 Mon Sep 17 00:00:00 2001 From: Seil0 Date: Mon, 1 Jul 2019 20:31:06 +0200 Subject: [PATCH] fixed the Sunday-fix --- .../mosad/seil0/projectlaogai/controller/CacheController.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt b/app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt index 2ad9e80..09c6aba 100644 --- a/app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt +++ b/app/src/main/java/org/mosad/seil0/projectlaogai/controller/CacheController.kt @@ -49,7 +49,7 @@ class CacheController(cont: Context) { cal.time = Date(mensaMenu.meta.updateTime * 1000) // if a) it's monday and the last cache update was on sunday or b) the cache is older than 24hr, update blocking - if ((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || currentTime - mensaMenu.meta.updateTime > 86400) { + if ((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (currentTime - mensaMenu.meta.updateTime) > 86400) { println("update mensa blocking") TCoRAPIController.getMensa(context).get() } @@ -58,8 +58,8 @@ class CacheController(cont: Context) { readTimetable(cCourse.courseName, 0, context) cal.time = Date(timetables[0].meta.updateTime * 1000) - // if a) it`s monday and the last cache update was not on a sunday or b) the cache is older than 5 days, update blocking - if((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || currentTime - timetables[0].meta.updateTime > 432000) { + // if a) it`s monday and the last cache update was not on a sunday or b) the cache is older than 24hr, update blocking + if((currentDay == Calendar.MONDAY && cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) || (currentTime - timetables[0].meta.updateTime) > 86400) { println("updating timetable after sunday!") val jobA = TCoRAPIController.getTimetable(cCourse.courseName, 0, context) val jobB = TCoRAPIController.getTimetable(cCourse.courseName, 1, context)