mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-22 06:27:46 +01:00
avoid duplicating repeat exception dates at events
This commit is contained in:
parent
3b6f06db8b
commit
5ee19b7bfc
@ -189,9 +189,10 @@ class EventsHelper(val context: Context) {
|
|||||||
fun addEventRepetitionException(parentEventId: Long, occurrenceTS: Long, addToCalDAV: Boolean) {
|
fun addEventRepetitionException(parentEventId: Long, occurrenceTS: Long, addToCalDAV: Boolean) {
|
||||||
Thread {
|
Thread {
|
||||||
val parentEvent = eventsDB.getEventWithId(parentEventId) ?: return@Thread
|
val parentEvent = eventsDB.getEventWithId(parentEventId) ?: return@Thread
|
||||||
val parentEventRepetitionExceptions = parentEvent.repetitionExceptions
|
var repetitionExceptions = parentEvent.repetitionExceptions
|
||||||
parentEventRepetitionExceptions.add(Formatter.getDayCodeFromTS(occurrenceTS))
|
repetitionExceptions.add(Formatter.getDayCodeFromTS(occurrenceTS))
|
||||||
eventsDB.updateEventRepetitionExceptions(parentEventRepetitionExceptions, parentEventId)
|
repetitionExceptions = repetitionExceptions.distinct().toMutableList() as ArrayList<String>
|
||||||
|
eventsDB.updateEventRepetitionExceptions(repetitionExceptions, parentEventId)
|
||||||
context.scheduleNextEventReminder(parentEvent)
|
context.scheduleNextEventReminder(parentEvent)
|
||||||
|
|
||||||
if (addToCalDAV && config.caldavSync) {
|
if (addToCalDAV && config.caldavSync) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user