adjust the end time of repeating events

This commit is contained in:
tibbi 2016-09-11 15:28:15 +02:00
parent a70c14b389
commit 88adcb1d9e
1 changed files with 4 additions and 1 deletions

View File

@ -170,7 +170,10 @@ public class DBHelper extends SQLiteOpenHelper {
final List<Event> newEvents = fillEvents(cursor);
for (Event e : newEvents) {
final int periods = (ts - e.getStartTS()) / e.getRepeatInterval();
e.setStartTS(e.getStartTS() + periods * e.getRepeatInterval());
final int newStartTS = e.getStartTS() + periods * e.getRepeatInterval();
final int newEndTS = newStartTS + (e.getEndTS() - e.getStartTS());
e.setStartTS(newStartTS);
e.setEndTS(newEndTS);
}
events.addAll(newEvents);
}