add repeatable event if UNTIL is the time of last occurences start

This commit is contained in:
tibbi 2017-04-09 21:13:30 +02:00
parent c18bd90f21
commit 1957320bc8
1 changed files with 7 additions and 7 deletions

View File

@ -387,14 +387,14 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
// get repeatable events
val selection = "$COL_REPEAT_INTERVAL != 0 AND $COL_START_TS < $toTS"
val events = getEvents(selection)
for (e in events) {
while (e.startTS < toTS && (e.repeatLimit == 0 || e.repeatLimit > e.endTS)) {
if (e.startTS >= fromTS) {
newEvents.add(e.copy())
} else if (getRunningEvents && (e.startTS <= fromTS && e.endTS >= toTS)) {
newEvents.add(e.copy())
for (event in events) {
while (event.startTS < toTS && (event.repeatLimit == 0 || event.repeatLimit >= event.startTS)) {
if (event.startTS >= fromTS) {
newEvents.add(event.copy())
} else if (getRunningEvents && (event.startTS <= fromTS && event.endTS >= toTS)) {
newEvents.add(event.copy())
}
e.addIntervalTime()
event.addIntervalTime()
}
}