From fa8952404a70ef11c42f121c21b33ee4005c4ea8 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 21 Dec 2018 08:59:01 +0100 Subject: [PATCH] Simplify account/operation stats --- .../main/java/eu/faircode/email/DaoAccount.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoAccount.java b/app/src/main/java/eu/faircode/email/DaoAccount.java index 060c004806..f0acf41b3c 100644 --- a/app/src/main/java/eu/faircode/email/DaoAccount.java +++ b/app/src/main/java/eu/faircode/email/DaoAccount.java @@ -71,16 +71,15 @@ public interface DaoAccount { LiveData liveAccount(long id); @Query("SELECT" + - " (SELECT COUNT(account.id) FROM account WHERE synchronize AND state = 'connected') AS accounts" + + " (SELECT COUNT(account.id) FROM account" + + " WHERE synchronize" + + " AND state = 'connected') AS accounts" + ", (SELECT COUNT(operation.id) FROM operation" + - " JOIN folder ON folder.id = operation.folder" + - " JOIN account ON account.id = folder.account" + - " WHERE account.synchronize) AS operations" + - ", (SELECT COUNT(message.id) FROM message" + - " JOIN folder ON folder.id = message.folder" + - " JOIN operation ON operation.message = message.id AND operation.name = '" + EntityOperation.SEND + "'" + - " WHERE NOT message.ui_seen" + - " AND folder.type = '" + EntityFolder.OUTBOX + "') AS unsent") + " JOIN folder ON folder.id = operation.folder" + + " JOIN account ON account.id = folder.account" + // not outbox + " WHERE account.synchronize) AS operations" + + ", (SELECT COUNT(operation.id) FROM operation" + + " WHERE operation.name = '" + EntityOperation.SEND + "') AS unsent") LiveData liveStats(); @Insert