fix #512, properly fetch running events and notify them only if needed
This commit is contained in:
parent
cb82bc66f2
commit
3270e28eed
|
@ -152,7 +152,9 @@ fun Context.getFilteredEvents(events: List<Event>): ArrayList<Event> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.notifyRunningEvents() {
|
fun Context.notifyRunningEvents() {
|
||||||
dbHelper.getRunningEvents().forEach { notifyEvent(it) }
|
dbHelper.getRunningEvents().filter { it.getReminders().isNotEmpty() }.forEach {
|
||||||
|
notifyEvent(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.notifyEvent(originalEvent: Event) {
|
fun Context.notifyEvent(originalEvent: Event) {
|
||||||
|
|
|
@ -815,7 +815,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||||
val events = ArrayList<Event>()
|
val events = ArrayList<Event>()
|
||||||
val ts = getNowSeconds()
|
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 selectionArgs = arrayOf(ts.toString(), ts.toString())
|
||||||
val cursor = getEventsCursor(selection, selectionArgs)
|
val cursor = getEventsCursor(selection, selectionArgs)
|
||||||
events.addAll(fillEvents(cursor))
|
events.addAll(fillEvents(cursor))
|
||||||
|
|
Loading…
Reference in New Issue