forked from github/szkolny
[Database/Announcements] Make announcements sort by start date.
This commit is contained in:
parent
2e18c5a668
commit
883d8f31c4
@ -1,7 +1,5 @@
|
|||||||
package pl.szczodrzynski.edziennik.data.db.modules.announcements;
|
package pl.szczodrzynski.edziennik.data.db.modules.announcements;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
import androidx.room.Dao;
|
import androidx.room.Dao;
|
||||||
import androidx.room.Insert;
|
import androidx.room.Insert;
|
||||||
@ -11,6 +9,8 @@ import androidx.room.RawQuery;
|
|||||||
import androidx.sqlite.db.SimpleSQLiteQuery;
|
import androidx.sqlite.db.SimpleSQLiteQuery;
|
||||||
import androidx.sqlite.db.SupportSQLiteQuery;
|
import androidx.sqlite.db.SupportSQLiteQuery;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
import pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata;
|
||||||
|
|
||||||
import static pl.szczodrzynski.edziennik.data.db.modules.metadata.Metadata.TYPE_ANNOUNCEMENT;
|
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 teachers USING(profileId, teacherId)\n" +
|
||||||
"LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" +
|
"LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" +
|
||||||
"WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" +
|
"WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" +
|
||||||
"ORDER BY addedDate DESC"));
|
"ORDER BY announcementStartDate DESC"));
|
||||||
}
|
}
|
||||||
public LiveData<List<AnnouncementFull>> getAll(int profileId) {
|
public LiveData<List<AnnouncementFull>> getAll(int profileId) {
|
||||||
return getAll(profileId, "1");
|
return getAll(profileId, "1");
|
||||||
@ -55,7 +55,7 @@ public abstract class AnnouncementDao {
|
|||||||
"LEFT JOIN teachers USING(profileId, teacherId)\n" +
|
"LEFT JOIN teachers USING(profileId, teacherId)\n" +
|
||||||
"LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" +
|
"LEFT JOIN metadata ON announcementId = thingId AND thingType = "+TYPE_ANNOUNCEMENT+" AND metadata.profileId = "+profileId+"\n" +
|
||||||
"WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" +
|
"WHERE announcements.profileId = "+profileId+" AND "+filter+"\n" +
|
||||||
"ORDER BY addedDate DESC"));
|
"ORDER BY announcementStartDate DESC"));
|
||||||
}
|
}
|
||||||
public List<AnnouncementFull> getNotNotifiedNow(int profileId) {
|
public List<AnnouncementFull> getNotNotifiedNow(int profileId) {
|
||||||
return getAllNow(profileId, "notified = 0");
|
return getAllNow(profileId, "notified = 0");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user