improve weekly and custom repetitions too

This commit is contained in:
tibbi 2018-05-06 10:44:21 +02:00
parent c44abf2957
commit bc7b1f0a3d

View File

@ -37,10 +37,16 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
else -> currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
}
repeatInterval % WEEK == 0 -> {
// step through weekly repetition by days too, as events can trigger multiple times a week
currStart.plusDays(1)
// step through weekly repetition by days, as events can trigger multiple times a week
startTS += DAY_SECONDS
endTS += DAY_SECONDS
return
}
else -> {
startTS += repeatInterval
endTS += repeatInterval
return
}
else -> currStart.plusSeconds(repeatInterval)
}
val newStartTS = newStart.seconds()
val newEndTS = newStartTS + (endTS - startTS)