mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
renaming currStart to oldStart at event repetition checking
This commit is contained in:
@ -39,31 +39,32 @@ data class Event(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addIntervalTime(original: Event) {
|
fun addIntervalTime(original: Event) {
|
||||||
val currStart = Formatter.getDateTimeFromTS(startTS)
|
val oldStart = Formatter.getDateTimeFromTS(startTS)
|
||||||
val newStart: DateTime
|
val newStart: DateTime
|
||||||
newStart = when (repeatInterval) {
|
newStart = when (repeatInterval) {
|
||||||
DAY -> currStart.plusDays(1)
|
DAY -> oldStart.plusDays(1)
|
||||||
else -> {
|
else -> {
|
||||||
when {
|
when {
|
||||||
repeatInterval % YEAR == 0 -> when (repeatRule) {
|
repeatInterval % YEAR == 0 -> when (repeatRule) {
|
||||||
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false)
|
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(oldStart, original, false)
|
||||||
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true)
|
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(oldStart, original, true)
|
||||||
else -> currStart.plusYears(repeatInterval / YEAR)
|
else -> oldStart.plusYears(repeatInterval / YEAR)
|
||||||
}
|
}
|
||||||
repeatInterval % MONTH == 0 -> when (repeatRule) {
|
repeatInterval % MONTH == 0 -> when (repeatRule) {
|
||||||
REPEAT_SAME_DAY -> addMonthsWithSameDay(currStart, original)
|
REPEAT_SAME_DAY -> addMonthsWithSameDay(oldStart, original)
|
||||||
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false)
|
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(oldStart, original, false)
|
||||||
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true)
|
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(oldStart, original, true)
|
||||||
else -> currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
|
else -> oldStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
|
||||||
}
|
}
|
||||||
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)
|
oldStart.plusDays(1)
|
||||||
}
|
}
|
||||||
else -> currStart.plusSeconds(repeatInterval)
|
else -> oldStart.plusSeconds(repeatInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val newStartTS = newStart.seconds()
|
val newStartTS = newStart.seconds()
|
||||||
val newEndTS = newStartTS + (endTS - startTS)
|
val newEndTS = newStartTS + (endTS - startTS)
|
||||||
startTS = newStartTS
|
startTS = newStartTS
|
||||||
|
Reference in New Issue
Block a user