diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt index b20d88fe9..07eae974e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/interfaces/EventsDao.kt @@ -21,34 +21,34 @@ interface EventsDao { @Query("SELECT * FROM events WHERE id = :id AND type = $TYPE_TASK") fun getTaskWithId(id: Long): Event? - @Query("SELECT * FROM events WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE id = :id") fun getEventOrTaskWithId(id: Long): Event? @Query("SELECT * FROM events WHERE import_id = :importId AND type = $TYPE_EVENT") fun getEventWithImportId(importId: String): Event? - @Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0") fun getOneTimeEventsOrTasksFromTo(toTS: Long, fromTS: Long): List @Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts >= :fromTS AND event_type IN (:eventTypeIds) AND type = $TYPE_TASK") fun getTasksFromTo(fromTS: Long, toTS: Long, eventTypeIds: List): List - @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND end_ts >= :fromTS AND repeat_interval = 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @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 - @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) AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @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): List @Query("SELECT * FROM events WHERE end_ts > :toTS AND repeat_interval = 0 AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT") fun getOneTimeFutureEventsWithTypes(toTS: Long, eventTypeIds: List): List - @Query("SELECT * FROM events WHERE start_ts <= :toTS AND repeat_interval != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE start_ts <= :toTS AND repeat_interval != 0") fun getRepeatableEventsOrTasksWithTypes(toTS: Long): List - @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND repeat_interval != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE id = :id AND start_ts <= :toTS AND repeat_interval != 0") fun getRepeatableEventsOrTasksWithId(id: Long, toTS: Long): List - @Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts != 0 AND repeat_interval != 0 AND event_type IN (:eventTypeIds) AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE start_ts <= :toTS AND start_ts != 0 AND repeat_interval != 0 AND event_type IN (:eventTypeIds)") fun getRepeatableEventsOrTasksWithTypes(toTS: Long, eventTypeIds: List): List @Query("SELECT * FROM events WHERE repeat_interval != 0 AND (repeat_limit == 0 OR repeat_limit > :currTS) AND event_type IN (:eventTypeIds) AND type = $TYPE_EVENT") @@ -73,7 +73,7 @@ interface EventsDao { fun getEventsWithIds(ids: List): List //val selection = "$COL_REMINDER_MINUTES != -1 AND ($COL_START_TS > ? OR $COL_REPEAT_INTERVAL != 0) AND $COL_START_TS != 0" - @Query("SELECT * FROM events WHERE reminder_1_minutes != -1 AND (start_ts > :currentTS OR repeat_interval != 0) AND start_ts != 0 AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("SELECT * FROM events WHERE reminder_1_minutes != -1 AND (start_ts > :currentTS OR repeat_interval != 0) AND start_ts != 0") fun getEventsOrTasksAtReboot(currentTS: Long): List @Query("SELECT id FROM events") @@ -103,10 +103,10 @@ interface EventsDao { @Query("UPDATE events SET import_id = :importId, source = :source WHERE id = :id AND type = $TYPE_EVENT") fun updateEventImportIdAndSource(importId: String, source: String, id: Long) - @Query("UPDATE events SET repeat_limit = :repeatLimit WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("UPDATE events SET repeat_limit = :repeatLimit WHERE id = :id") fun updateEventRepetitionLimit(repeatLimit: Long, id: Long) - @Query("UPDATE events SET repetition_exceptions = :repetitionExceptions WHERE id = :id AND (type = $TYPE_EVENT OR type = $TYPE_TASK)") + @Query("UPDATE events SET repetition_exceptions = :repetitionExceptions WHERE id = :id") fun updateEventRepetitionExceptions(repetitionExceptions: String, id: Long) @Deprecated("Use Context.updateTaskCompletion() instead unless you know what you are doing.")