Refactoring

pull/159/head
M66B 5 years ago
parent 968c6800d3
commit ab50d9db77

@ -67,8 +67,7 @@ public interface DaoMessage {
" AND (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0)" + " AND (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0)" +
" AND (NOT :filter_unflagged OR COUNT(message.id) - SUM(1 - message.ui_flagged) > 0)" + " AND (NOT :filter_unflagged OR COUNT(message.id) - SUM(1 - message.ui_flagged) > 0)" +
" AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL)" + " AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL)" +
" ORDER BY" + " ORDER BY CASE" +
" CASE" +
" WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" + " WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" + " WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" + " WHEN 'sender' = :sort THEN LOWER(message.sender)" +
@ -112,8 +111,7 @@ public interface DaoMessage {
" AND (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0 OR " + is_outbox + ")" + " AND (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0 OR " + is_outbox + ")" +
" AND (NOT :filter_unflagged OR COUNT(message.id) - SUM(1 - message.ui_flagged) > 0 OR " + is_outbox + ")" + " AND (NOT :filter_unflagged OR COUNT(message.id) - SUM(1 - message.ui_flagged) > 0 OR " + is_outbox + ")" +
" AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL OR " + is_outbox + ")" + " AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL OR " + is_outbox + ")" +
" ORDER BY" + " ORDER BY CASE" +
" CASE" +
" WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" + " WHEN 'unread' = :sort THEN SUM(1 - message.ui_seen) = 0" +
" WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" + " WHEN 'starred' = :sort THEN COUNT(message.id) - SUM(1 - message.ui_flagged) = 0" +
" WHEN 'sender' = :sort THEN LOWER(message.sender)" + " WHEN 'sender' = :sort THEN LOWER(message.sender)" +

Loading…
Cancel
Save