add separate functions for getting one-time events

This commit is contained in:
tibbi 2018-11-16 14:48:14 +01:00
parent b97cbf6ce9
commit 932cee76b0
2 changed files with 9 additions and 9 deletions

View file

@ -255,13 +255,13 @@ class EventsHelper(val context: Context) {
callback(ArrayList())
return
} else {
eventsDB.getEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event>
eventsDB.getOneTimeEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event>
}
} else {
if (eventId == -1L) {
eventsDB.getEventsFromTo(toTS, fromTS).toMutableList() as ArrayList<Event>
eventsDB.getOneTimeEventsFromTo(toTS, fromTS).toMutableList() as ArrayList<Event>
} else {
eventsDB.getEventFromToWithId(eventId, toTS, fromTS).toMutableList() as ArrayList<Event>
eventsDB.getOneTimeEventFromToWithId(eventId, toTS, fromTS).toMutableList() as ArrayList<Event>
}
}

View file

@ -17,14 +17,14 @@ interface EventsDao {
@Query("SELECT * FROM events WHERE id = :id")
fun getEventWithId(id: Long): Event?
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS")
fun getEventsFromTo(toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getOneTimeEventsFromTo(toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS")
fun getEventFromToWithId(id: Long, toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getOneTimeEventFromToWithId(id: Long, toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND start_ts != 0 AND event_type IN (:eventTypeIds)")
fun getEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND start_ts != 0 AND repeat_interval = 0 AND event_type IN (:eventTypeIds)")
fun getOneTimeEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE id IN (:ids) AND import_id != \"\"")
fun getEventsByIdsWithImportIds(ids: List<Long>): List<Event>