Fixed thread stats

This commit is contained in:
M66B 2020-04-01 11:09:45 +02:00
parent 7f2ea40ace
commit e11c9a4067
2 changed files with 7 additions and 2 deletions

View File

@ -215,12 +215,17 @@ public interface DaoMessage {
", SUM(message.ui_seen) AS seen" + ", SUM(message.ui_seen) AS seen" +
" FROM message" + " FROM message" +
" JOIN account_view AS account ON account.id = message.account" + " JOIN account_view AS account ON account.id = message.account" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" WHERE message.account = :account" + " WHERE message.account = :account" +
" AND message.thread = :thread" + " AND message.thread = :thread" +
" AND (:id IS NULL OR message.id = :id)" + " AND (:id IS NULL OR message.id = :id)" +
" AND (NOT :filter_archive OR folder.type <> '" + EntityFolder.ARCHIVE +
"' OR (SELECT COUNT(m.id) FROM message m" +
" WHERE m.account = message.account" +
" AND (m.hash = message.hash OR m.msgid = message.msgid)) = 1)" +
" AND NOT message.ui_hide" + " AND NOT message.ui_hide" +
" GROUP BY account.id") " GROUP BY account.id")
LiveData<TupleThreadStats> liveThreadStats(long account, String thread, Long id); LiveData<TupleThreadStats> liveThreadStats(long account, String thread, Long id, boolean filter_archive);
@Query("SELECT message.id FROM folder" + @Query("SELECT message.id FROM folder" +
" JOIN message ON message.folder = folder.id" + " JOIN message ON message.folder = folder.id" +

View File

@ -3065,7 +3065,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
break; break;
case THREAD: case THREAD:
db.message().liveThreadStats(account, thread, null).observe(getViewLifecycleOwner(), new Observer<TupleThreadStats>() { db.message().liveThreadStats(account, thread, null, filter_archive).observe(getViewLifecycleOwner(), new Observer<TupleThreadStats>() {
@Override @Override
public void onChanged(TupleThreadStats stats) { public void onChanged(TupleThreadStats stats) {
if (stats == null) if (stats == null)