Properly count occurrences

This commit is contained in:
Naveen 2023-06-24 16:04:10 +05:30
parent 46e17aa697
commit acff39740e
No known key found for this signature in database
GPG Key ID: 0E155DAD31671DA3
1 changed files with 2 additions and 2 deletions

View File

@ -1381,8 +1381,8 @@ class EventActivity : SimpleActivity() {
val hasFixedRepeatCount = originalEvent.repeatLimit < 0 && mEvent.repeatLimit < 0
val repeatLimitUnchanged = originalEvent.repeatLimit == mEvent.repeatLimit
if (hasFixedRepeatCount && repeatLimitUnchanged) {
val daysSinceStart = (mEventOccurrenceTS - originalEvent.startTS) / DAY
val newRepeatLimit = mEvent.repeatLimit + daysSinceStart
val occurrencesSinceStart = (mEventOccurrenceTS - originalEvent.startTS) / originalEvent.repeatInterval
val newRepeatLimit = mEvent.repeatLimit + occurrencesSinceStart
mEvent.repeatLimit = newRepeatLimit
}