forked from github/szkolny
[Vulcan/Hebe] Add filtering data by current school year.
This commit is contained in:
parent
b599d679c4
commit
30aeb70647
@ -156,6 +156,12 @@ open class VulcanHebe(open val data: DataVulcan, open val lastSync: Long?) {
|
||||
} ?: false
|
||||
}
|
||||
|
||||
fun isCurrentYear(dateTime: Long): Boolean {
|
||||
return profile?.let { profile ->
|
||||
return@let profile.dateSemester1Start.inMillis >= dateTime
|
||||
} ?: false
|
||||
}
|
||||
|
||||
inline fun <reified T> apiRequest(
|
||||
tag: String,
|
||||
endpoint: String,
|
||||
|
@ -40,6 +40,8 @@ class VulcanHebeExams(
|
||||
?: -1
|
||||
val topic = exam.getString("Content")?.trim() ?: ""
|
||||
|
||||
if (!isCurrentYear(eventDate)) return@forEach
|
||||
|
||||
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||
|
||||
|
@ -38,6 +38,8 @@ class VulcanHebeHomework(
|
||||
val teamId = data.teamClass?.id ?: -1
|
||||
val topic = exam.getString("Content")?.trim() ?: ""
|
||||
|
||||
if (!isCurrentYear(eventDate)) return@forEach
|
||||
|
||||
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||
|
||||
|
@ -80,6 +80,8 @@ class VulcanHebeMessages(
|
||||
val sentDate = getDateTime(message, "DateSent")
|
||||
val readDate = getDateTime(message, "DateRead", default = 0)
|
||||
|
||||
if (!isCurrentYear(sentDate)) return@forEach
|
||||
|
||||
val messageObject = Message(
|
||||
profileId = profileId,
|
||||
id = id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user