fix displaying of events repeating by x weeks

This commit is contained in:
tibbi 2017-05-07 16:40:08 +02:00
parent 5c01bee1ae
commit eed35834fc
1 changed files with 7 additions and 1 deletions

View File

@ -392,7 +392,13 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
if (it.startTS >= fromTS) {
if (it.repeatInterval % WEEK == 0) {
if (it.startTS.isTsOnProperDay(it)) {
newEvents.add(it.copy())
val initialWeekOfYear = Formatter.getDateTimeFromTS(startTimes[it.id]).weekOfWeekyear
val currentWeekOfYear = Formatter.getDateTimeFromTS(it.startTS).weekOfWeekyear
// check if its the proper week, for events repeating by x weeks
if ((currentWeekOfYear - initialWeekOfYear) % (it.repeatInterval / WEEK) == 0) {
newEvents.add(it.copy())
}
}
} else {
newEvents.add(it.copy())