Refactoring

This commit is contained in:
M66B
2020-03-28 10:02:00 +01:00
parent fa7723695d
commit 5e5213f5b8
3 changed files with 68 additions and 68 deletions

View File

@@ -350,29 +350,6 @@ public interface DaoMessage {
" WHERE message.id = :id")
LiveData<TupleKeyword.Persisted> liveMessageKeywords(long id);
@Transaction
@Query("SELECT account.id AS account, COUNT(message.id) AS unseen, SUM(ABS(notifying)) AS notifying" +
" FROM message" +
" JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE (:account IS NULL OR account.id = :account)" +
" AND account.`synchronize`" +
" AND folder.notify" +
" AND NOT (message.ui_seen OR message.ui_hide)" +
" GROUP BY account.id" +
" ORDER BY account.id")
LiveData<List<TupleMessageStats>> liveUnseenWidget(Long account);
@Query("SELECT :account AS account, COUNT(message.id) AS unseen, SUM(ABS(notifying)) AS notifying" +
" FROM message" +
" JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE (:account IS NULL OR account.id = :account)" +
" AND account.`synchronize`" +
" AND folder.notify" +
" AND NOT (message.ui_seen OR message.ui_hide)")
TupleMessageStats getUnseenWidget(Long account);
@Transaction
@Query("SELECT message.*" +
", account.pop AS accountProtocol, account.name AS accountName, COALESCE(identity.color, folder.color, account.color) AS accountColor" +
@@ -401,6 +378,29 @@ public interface DaoMessage {
" ORDER BY message.received")
LiveData<List<TupleMessageEx>> liveUnseenNotify();
@Transaction
@Query("SELECT account.id AS account, COUNT(message.id) AS unseen, SUM(ABS(notifying)) AS notifying" +
" FROM message" +
" JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE (:account IS NULL OR account.id = :account)" +
" AND account.`synchronize`" +
" AND folder.notify" +
" AND NOT (message.ui_seen OR message.ui_hide)" +
" GROUP BY account.id" +
" ORDER BY account.id")
LiveData<List<TupleMessageStats>> liveWidgetUnseen(Long account);
@Query("SELECT :account AS account, COUNT(message.id) AS unseen, SUM(ABS(notifying)) AS notifying" +
" FROM message" +
" JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE (:account IS NULL OR account.id = :account)" +
" AND account.`synchronize`" +
" AND folder.notify" +
" AND NOT (message.ui_seen OR message.ui_hide)")
TupleMessageStats getWidgetUnseen(Long account);
@Transaction
@Query("SELECT folder, COUNT(*) AS total" +
", SUM(ui_seen) AS seen" +