From 883d8f31c4057dac13a7869b8c5146a05f49bb11 Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sun, 8 Dec 2019 00:28:46 +0100 Subject: [PATCH] [Database/Announcements] Make announcements sort by start date. --- .../data/db/modules/announcements/AnnouncementDao.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/announcements/AnnouncementDao.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/announcements/AnnouncementDao.java index 852e16f4..a7a81283 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/announcements/AnnouncementDao.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/modules/announcements/AnnouncementDao.java @@ -1,7 +1,5 @@ package pl.szczodrzynski.edziennik.data.db.modules.announcements; -import java.util.List; - import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Insert; @@ -11,6 +9,8 @@ import androidx.room.RawQuery; import androidx.sqlite.db.SimpleSQLiteQuery; import androidx.sqlite.db.SupportSQLiteQuery; +import java.util.List; + import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata; import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT; @@ -36,7 +36,7 @@ public abstract class AnnouncementDao { "LEFT JOIN teachers USING(profileId, teacherId)\n" + "LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" + "WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" + - "ORDER BY addedDate DESC")); + "ORDER BY announcementStartDate DESC")); } public LiveData> getAll(int profileId) { return getAll(profileId, "1"); @@ -55,7 +55,7 @@ public abstract class AnnouncementDao { "LEFT JOIN teachers USING(profileId, teacherId)\n" + "LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" + "WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" + - "ORDER BY addedDate DESC")); + "ORDER BY announcementStartDate DESC")); } public List getNotNotifiedNow(int profileId) { return getAllNow(profileId, "notified = 0");