[API/DataRemoveModel] Make DAO not remove TYPE_NO_LESSON entries.

This commit is contained in:
Kuba Szczodrzyński 2020-01-06 16:54:35 +01:00
parent ff0de8afc2
commit 0227762ddc
2 changed files with 4 additions and 4 deletions

View File

@ -38,11 +38,11 @@ interface TimetableDao {
@Query("DELETE FROM timetable WHERE profileId = :profileId") @Query("DELETE FROM timetable WHERE profileId = :profileId")
fun clear(profileId: Int) fun clear(profileId: Int)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND ((type != 3 AND date >= :dateFrom) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom))") @Query("DELETE FROM timetable WHERE profileId = :profileId AND type != -1 AND ((type != 3 AND date >= :dateFrom) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom))")
fun clearFromDate(profileId: Int, dateFrom: Date) fun clearFromDate(profileId: Int, dateFrom: Date)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND ((type != 3 AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate <= :dateTo))") @Query("DELETE FROM timetable WHERE profileId = :profileId AND type != -1 AND ((type != 3 AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate <= :dateTo))")
fun clearToDate(profileId: Int, dateTo: Date) fun clearToDate(profileId: Int, dateTo: Date)
@Query("DELETE FROM timetable WHERE profileId = :profileId AND ((type != 3 AND date >= :dateFrom AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom AND oldDate <= :dateTo))") @Query("DELETE FROM timetable WHERE profileId = :profileId AND type != -1 AND ((type != 3 AND date >= :dateFrom AND date <= :dateTo) OR ((type = 3 OR type = 1) AND oldDate >= :dateFrom AND oldDate <= :dateTo))")
fun clearBetweenDates(profileId: Int, dateFrom: Date, dateTo: Date) fun clearBetweenDates(profileId: Int, dateFrom: Date, dateTo: Date)
@Query(""" @Query("""

View File

@ -173,7 +173,7 @@ class TimetableDayFragment : Fragment(), CoroutineScope {
} }
dayView.setHourLabelViews(hourLabelViews) dayView.setHourLabelViews(hourLabelViews)
buildLessonViews(lessons, events) buildLessonViews(lessons.filter { it.type != Lesson.TYPE_NO_LESSONS }, events)
} }
private fun buildLessonViews(lessons: List<LessonFull>, events: List<EventFull>) { private fun buildLessonViews(lessons: List<LessonFull>, events: List<EventFull>) {