some formatting update at events

This commit is contained in:
tibbi
2017-09-10 15:50:17 +02:00
parent 77ae86f6ab
commit 1d7ba8ee0a

View File

@@ -24,21 +24,18 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
newStart = when (repeatInterval) { newStart = when (repeatInterval) {
DAY -> currStart.plusDays(1) DAY -> currStart.plusDays(1)
else -> { else -> {
if (repeatInterval % YEAR == 0) { when {
currStart.plusYears(repeatInterval / YEAR) repeatInterval % YEAR == 0 -> currStart.plusYears(repeatInterval / YEAR)
} else if (repeatInterval % MONTH == 0) { repeatInterval % MONTH == 0 -> when (repeatRule) {
if (repeatRule == REPEAT_MONTH_SAME_DAY) { REPEAT_MONTH_SAME_DAY -> addMonthsWithSameDay(currStart, original)
addMonthsWithSameDay(currStart, original) REPEAT_MONTH_EVERY_XTH_DAY -> addXthDayInterval(currStart, original)
} else if (repeatRule == REPEAT_MONTH_EVERY_XTH_DAY) { else -> currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
addXthDayInterval(currStart, original)
} else {
currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
} }
} else if (repeatInterval % WEEK == 0) { repeatInterval % WEEK == 0 -> {
// step through weekly repetition by days too, as events can trigger multiple times a week // step through weekly repetition by days too, as events can trigger multiple times a week
currStart.plusDays(1) currStart.plusDays(1)
} else { }
currStart.plusSeconds(repeatInterval) else -> currStart.plusSeconds(repeatInterval)
} }
} }
} }