fix #512, properly fetch running events and notify them only if needed

This commit is contained in:
tibbi 2018-07-14 17:34:11 +02:00
parent cb82bc66f2
commit 3270e28eed
2 changed files with 4 additions and 2 deletions

View File

@ -152,7 +152,9 @@ fun Context.getFilteredEvents(events: List<Event>): ArrayList<Event> {
}
fun Context.notifyRunningEvents() {
dbHelper.getRunningEvents().forEach { notifyEvent(it) }
dbHelper.getRunningEvents().filter { it.getReminders().isNotEmpty() }.forEach {
notifyEvent(it)
}
}
fun Context.notifyEvent(originalEvent: Event) {

View File

@ -815,7 +815,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
val events = ArrayList<Event>()
val ts = getNowSeconds()
val selection = "$COL_START_TS <= ? AND $COL_END_TS >= ? AND $COL_REPEAT_INTERVAL IS 0 AND $COL_START_TS != 0"
val selection = "$COL_START_TS <= ? AND $COL_END_TS >= ? AND $COL_REPEAT_INTERVAL IS NULL AND $COL_START_TS != 0"
val selectionArgs = arrayOf(ts.toString(), ts.toString())
val cursor = getEventsCursor(selection, selectionArgs)
events.addAll(fillEvents(cursor))