diff --git a/firka/lib/helpers/api/client/kreta_client.dart b/firka/lib/helpers/api/client/kreta_client.dart index f4dfbae..d1d5bc8 100644 --- a/firka/lib/helpers/api/client/kreta_client.dart +++ b/firka/lib/helpers/api/client/kreta_client.dart @@ -166,7 +166,11 @@ class KretaClient { ApiResponse? studentCache; Future> getStudent({bool forceCache = true}) async { - if (forceCache && studentCache != null) return studentCache!; + if (!forceCache) { + studentCache = null; + } else if (studentCache != null) { + return studentCache!; + } var (resp, status, ex, cached) = await _cachingGet(CacheId.getStudent, KretaEndpoints.getStudentUrl(model.iss!), forceCache, 0); @@ -191,7 +195,11 @@ class KretaClient { Future>> getClassGroups( {bool forceCache = true}) async { - if (forceCache && classGroupCache != null) return classGroupCache!; + if (!forceCache) { + classGroupCache = null; + } else { + if (classGroupCache != null) return classGroupCache!; + } var (resp, status, ex, cached) = await _cachingGet(CacheId.getClassGroup, KretaEndpoints.getClassGroups(model.iss!), forceCache, 0); @@ -219,7 +227,11 @@ class KretaClient { Future>> getNoticeBoard( {bool forceCache = true}) async { - if (forceCache && noticeBoardCache != null) return noticeBoardCache!; + if (!forceCache) { + noticeBoardCache = null; + } else if (noticeBoardCache != null) { + return noticeBoardCache!; + } var (resp, status, ex, cached) = await _cachingGet(CacheId.getNoticeBoard, KretaEndpoints.getNoticeBoard(model.iss!), forceCache, 0); @@ -274,7 +286,9 @@ class KretaClient { ApiResponse>? gradeCache; Future>> getGrades({bool forceCache = true}) async { - if (forceCache && gradeCache != null) { + if (!forceCache) { + gradeCache = null; + } else if (gradeCache != null) { return gradeCache!; } var (resp, status, ex, cached) = await _cachingGet( @@ -577,7 +591,11 @@ class KretaClient { Future>> getOmissions( {bool forceCache = true}) async { - if (omissionsCache != null) return omissionsCache!; + if (!forceCache) { + omissionsCache = null; + } else { + if (omissionsCache != null) return omissionsCache!; + } var (resp, status, ex, cached) = await _cachingGet(CacheId.getOmissions, KretaEndpoints.getOmissions(model.iss!), forceCache, 0); diff --git a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart index 05a012e..8d00a4e 100644 --- a/firka/lib/ui/phone/pages/home/home_timetable_mo.dart +++ b/firka/lib/ui/phone/pages/home/home_timetable_mo.dart @@ -46,9 +46,6 @@ class _HomeTimetableMonthlyScreen extends State { _HomeTimetableMonthlyScreen(); Future initForMonth(DateTime now, {bool forceCache = true}) async { - if (!forceCache) { - widget.data.client.evictMemCache(); - } final monthStart = DateTime.utc(now.year, now.month, 1); final monthEnd = DateTime.utc(now.year, now.month + 1).subtract(Duration(days: 1));