forked from github/szkolny
[API/Librus] Fix syncing past homework.
This commit is contained in:
parent
aff0b361a2
commit
f292b3637d
@ -23,9 +23,13 @@ class LibrusSynergiaHomework(override val data: DataLibrus, val onSuccess: () ->
|
|||||||
const val TAG = "LibrusSynergiaHomework"
|
const val TAG = "LibrusSynergiaHomework"
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init { data.profile?.also { profile ->
|
||||||
synergiaGet(TAG, "moje_zadania", method = POST, parameters = mapOf(
|
synergiaGet(TAG, "moje_zadania", method = POST, parameters = mapOf(
|
||||||
"dataOd" to Date.getToday().stringY_m_d,
|
"dataOd" to
|
||||||
|
if (!data.profile.empty)
|
||||||
|
profile.getSemesterStart(1).stringY_m_d
|
||||||
|
else
|
||||||
|
Date.getToday().stringY_m_d,
|
||||||
"dataDo" to Date.getToday().stepForward(0, 0, 7).stringY_m_d,
|
"dataDo" to Date.getToday().stepForward(0, 0, 7).stringY_m_d,
|
||||||
"przedmiot" to -1
|
"przedmiot" to -1
|
||||||
|
|
||||||
@ -61,7 +65,7 @@ class LibrusSynergiaHomework(override val data: DataLibrus, val onSuccess: () ->
|
|||||||
val description = "Treść: (.*)".toRegex(RegexOption.DOT_MATCHES_ALL).find(moreInfo)
|
val description = "Treść: (.*)".toRegex(RegexOption.DOT_MATCHES_ALL).find(moreInfo)
|
||||||
?.get(1)?.replace("<br.*/>".toRegex(), "\n")?.trim()
|
?.get(1)?.replace("<br.*/>".toRegex(), "\n")?.trim()
|
||||||
|
|
||||||
val seen = when (profile?.empty) {
|
val seen = when (profile.empty) {
|
||||||
true -> true
|
true -> true
|
||||||
else -> eventDate < Date.getToday()
|
else -> eventDate < Date.getToday()
|
||||||
}
|
}
|
||||||
@ -98,5 +102,5 @@ class LibrusSynergiaHomework(override val data: DataLibrus, val onSuccess: () ->
|
|||||||
data.setSyncNext(ENDPOINT_LIBRUS_SYNERGIA_HOMEWORK, 2 * HOUR, DRAWER_ITEM_HOMEWORK)
|
data.setSyncNext(ENDPOINT_LIBRUS_SYNERGIA_HOMEWORK, 2 * HOUR, DRAWER_ITEM_HOMEWORK)
|
||||||
onSuccess()
|
onSuccess()
|
||||||
}
|
}
|
||||||
}
|
} ?: onSuccess() }
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class NotifyTask : IApiTask(-1) {
|
|||||||
val list = app.db.notificationDao().getNotPostedNow()
|
val list = app.db.notificationDao().getNotPostedNow()
|
||||||
val notificationList = list.subList(0, min(10, list.size))
|
val notificationList = list.subList(0, min(10, list.size))
|
||||||
|
|
||||||
var unreadCount = list.size
|
val unreadCount = list.size
|
||||||
|
|
||||||
for (notification in notificationList) {
|
for (notification in notificationList) {
|
||||||
val intent = Intent(app, MainActivity::class.java)
|
val intent = Intent(app, MainActivity::class.java)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user