Don't schedule reminder for completed tasks
This commit is contained in:
parent
a67c1c79db
commit
908e3853d3
1 changed files with 6 additions and 0 deletions
|
@ -117,9 +117,15 @@ fun Context.scheduleNextEventReminder(event: Event, showToasts: Boolean) {
|
||||||
|
|
||||||
val now = getNowSeconds()
|
val now = getNowSeconds()
|
||||||
val reminderSeconds = validReminders.reversed().map { it.minutes * 60 }
|
val reminderSeconds = validReminders.reversed().map { it.minutes * 60 }
|
||||||
|
val isTask = event.isTask()
|
||||||
eventsHelper.getEvents(now, now + YEAR, event.id!!, false) { events ->
|
eventsHelper.getEvents(now, now + YEAR, event.id!!, false) { events ->
|
||||||
if (events.isNotEmpty()) {
|
if (events.isNotEmpty()) {
|
||||||
for (curEvent in events) {
|
for (curEvent in events) {
|
||||||
|
if (isTask && curEvent.isTaskCompleted()) {
|
||||||
|
// skip scheduling reminders for completed tasks
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
for (curReminder in reminderSeconds) {
|
for (curReminder in reminderSeconds) {
|
||||||
if (curEvent.getEventStartTS() - curReminder > now) {
|
if (curEvent.getEventStartTS() - curReminder > now) {
|
||||||
scheduleEventIn((curEvent.getEventStartTS() - curReminder) * 1000L, curEvent, showToasts)
|
scheduleEventIn((curEvent.getEventStartTS() - curReminder) * 1000L, curEvent, showToasts)
|
||||||
|
|
Loading…
Reference in a new issue