mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-18 12:56:45 -06:00
[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
|
} ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isCurrentYear(dateTime: Long): Boolean {
|
||||||
|
return profile?.let { profile ->
|
||||||
|
return@let profile.dateSemester1Start.inMillis >= dateTime
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
|
||||||
inline fun <reified T> apiRequest(
|
inline fun <reified T> apiRequest(
|
||||||
tag: String,
|
tag: String,
|
||||||
endpoint: String,
|
endpoint: String,
|
||||||
|
@ -40,6 +40,8 @@ class VulcanHebeExams(
|
|||||||
?: -1
|
?: -1
|
||||||
val topic = exam.getString("Content")?.trim() ?: ""
|
val topic = exam.getString("Content")?.trim() ?: ""
|
||||||
|
|
||||||
|
if (!isCurrentYear(eventDate)) return@forEach
|
||||||
|
|
||||||
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
||||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ class VulcanHebeHomework(
|
|||||||
val teamId = data.teamClass?.id ?: -1
|
val teamId = data.teamClass?.id ?: -1
|
||||||
val topic = exam.getString("Content")?.trim() ?: ""
|
val topic = exam.getString("Content")?.trim() ?: ""
|
||||||
|
|
||||||
|
if (!isCurrentYear(eventDate)) return@forEach
|
||||||
|
|
||||||
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
val lessonList = data.db.timetableDao().getAllForDateNow(profileId, eventDate)
|
||||||
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
val startTime = lessonList.firstOrNull { it.subjectId == subjectId }?.startTime
|
||||||
|
|
||||||
|
@ -80,6 +80,8 @@ class VulcanHebeMessages(
|
|||||||
val sentDate = getDateTime(message, "DateSent")
|
val sentDate = getDateTime(message, "DateSent")
|
||||||
val readDate = getDateTime(message, "DateRead", default = 0)
|
val readDate = getDateTime(message, "DateRead", default = 0)
|
||||||
|
|
||||||
|
if (!isCurrentYear(sentDate)) return@forEach
|
||||||
|
|
||||||
val messageObject = Message(
|
val messageObject = Message(
|
||||||
profileId = profileId,
|
profileId = profileId,
|
||||||
id = id,
|
id = id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user