diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt index 4fcf6393a..aabcee3ba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -55,7 +55,7 @@ fun Context.scheduleNextEvent(event: Event) { newTS = getNewTS(startTS, false) } - if (newTS != 0) + if (newTS != 0 && (event.repeatLimit == 0 || event.repeatLimit > newTS)) scheduleEventIn(newTS, event) } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index b5bafa576..a685dc460 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -218,7 +218,7 @@ class DBHelper(context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_V val selection = "$COL_REPEAT_INTERVAL != 0 AND $COL_START_TS < $toTS" val events = getEvents(selection) for (e in events) { - while (e.startTS < toTS) { + while (e.startTS < toTS && (e.repeatLimit == 0 || e.repeatLimit > e.endTS)) { if (e.startTS > fromTS) { val newEvent = Event(e.id, e.startTS, e.endTS, e.title, e.description, e.reminderMinutes, e.repeatInterval, e.importId, e.flags) newEvents.add(newEvent)