Show number of drafts in navigation menu

This commit is contained in:
M66B
2019-11-08 14:48:20 +01:00
parent 79611bb034
commit 1f4d0c1243
6 changed files with 44 additions and 27 deletions

View File

@@ -111,6 +111,7 @@ public interface DaoFolder {
@Query("SELECT folder.*" +
", account.`order` AS accountOrder, account.name AS accountName" +
", COUNT(message.id) AS messages" +
", SUM(CASE WHEN NOT message.ui_seen THEN 1 ELSE 0 END) AS unseen" +
", SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) AS snoozed" +
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id) AS operations" +
@@ -153,8 +154,9 @@ public interface DaoFolder {
" AND type <> '" + EntityFolder.USER + "'")
List<EntityFolder> getSystemFolders(long account);
@Query("SELECT folder.type," +
" SUM(CASE WHEN NOT message.ui_seen AND NOT message.ui_hide THEN 1 ELSE 0 END) AS unseen" +
@Query("SELECT folder.type" +
", COUNT(message.id) AS messages" +
", SUM(CASE WHEN NOT message.ui_seen AND NOT message.ui_hide THEN 1 ELSE 0 END) AS unseen" +
" FROM folder" +
" JOIN account ON account.id = folder.account" +
" LEFT JOIN message ON message.folder = folder.id" +
@@ -162,7 +164,7 @@ public interface DaoFolder {
" AND folder.type <> '" + EntityFolder.SYSTEM + "'" +
" AND folder.type <> '" + EntityFolder.USER + "'" +
" GROUP BY folder.type")
LiveData<List<EntityFolderUnified>> liveUnified();
LiveData<List<TupleFolderUnified>> liveUnified();
@Query("SELECT * FROM folder WHERE id = :id")
EntityFolder getFolder(Long id);