Fixed folder message count

pull/146/head
M66B 6 years ago
parent 29c398eb1e
commit 444ed41e50

@ -50,7 +50,7 @@ public interface DaoFolder {
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
" FROM folder" +
" LEFT JOIN account ON account.id = folder.account" +
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide AND NOT message.ui_found" +
" WHERE folder.account = :account OR folder.account IS NULL" +
" GROUP BY folder.id")
LiveData<List<TupleFolderEx>> liveFolders(long account);
@ -66,7 +66,7 @@ public interface DaoFolder {
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
" FROM folder" +
" JOIN account ON account.id = folder.account" +
" JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
" JOIN message ON message.folder = folder.id AND NOT message.ui_hide AND NOT message.ui_found" +
" WHERE account.`synchronize`" +
" AND folder.unified" +
" GROUP BY folder.id")
@ -81,7 +81,7 @@ public interface DaoFolder {
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
" FROM folder" +
" LEFT JOIN account ON account.id = folder.account" +
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide AND NOT message.ui_found" +
" WHERE folder.id = :id")
LiveData<TupleFolderEx> liveFolderEx(long id);

Loading…
Cancel
Save