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()) callback(ArrayList())
return return
} else { } else {
eventsDB.getEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event> eventsDB.getOneTimeEventsFromToWithTypes(toTS, fromTS, context.config.getDisplayEventTypessAsList()).toMutableList() as ArrayList<Event>
} }
} else { } else {
if (eventId == -1L) { if (eventId == -1L) {
eventsDB.getEventsFromTo(toTS, fromTS).toMutableList() as ArrayList<Event> eventsDB.getOneTimeEventsFromTo(toTS, fromTS).toMutableList() as ArrayList<Event>
} else { } 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") @Query("SELECT * FROM events WHERE id = :id")
fun getEventWithId(id: Long): Event? fun getEventWithId(id: Long): Event?
@Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS") @Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getEventsFromTo(toTS: Long, fromTS: Long): List<Event> fun getOneTimeEventsFromTo(toTS: Long, fromTS: Long): List<Event>
@Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS") @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0")
fun getEventFromToWithId(id: Long, toTS: Long, fromTS: Long): List<Event> 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)") @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 getEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event> fun getOneTimeEventsFromToWithTypes(toTS: Long, fromTS: Long, eventTypeIds: List<Long>): List<Event>
@Query("SELECT * FROM events WHERE id IN (:ids) AND import_id != \"\"") @Query("SELECT * FROM events WHERE id IN (:ids) AND import_id != \"\"")
fun getEventsByIdsWithImportIds(ids: List<Long>): List<Event> fun getEventsByIdsWithImportIds(ids: List<Long>): List<Event>