Refactoring

This commit is contained in:
M66B 2019-02-28 15:19:15 +00:00
parent 561b2e699d
commit e6cfe55aa2
3 changed files with 5 additions and 4 deletions

View File

@ -83,7 +83,7 @@ public interface DaoAccount {
", (SELECT COUNT(operation.id) FROM operation" +
" JOIN folder ON folder.id = operation.folder" +
" JOIN account ON account.id = folder.account" + // not outbox
" WHERE account.synchronize) AS operations")
" WHERE account.synchronize) AS operations") // including on demand
LiveData<TupleAccountStats> liveStats();
@Query("SELECT account.id, swipe_left, l.type AS left_type, swipe_right, r.type AS right_type" +

View File

@ -48,7 +48,8 @@ public interface DaoFolder {
@Query("SELECT folder.* FROM folder" +
" JOIN account ON account.id = folder.account" +
" WHERE account.synchronize AND folder.synchronize AND unified")
" WHERE account.synchronize" +
" AND folder.synchronize AND unified")
List<EntityFolder> getFoldersSynchronizingUnified();
@Query("SELECT folder.* FROM folder" +

View File

@ -29,7 +29,7 @@ import androidx.room.Query;
@Dao
public interface DaoOperation {
@Query("SELECT operation.*, account.name AS accountName, folder.name AS folderName" +
" ,((account.synchronize IS NULL OR account.synchronize)" +
" ,((account.synchronize IS NULL OR account.synchronize)" + // including on demand
" AND (NOT folder.account IS NULL OR identity.synchronize IS NULL OR identity.synchronize)) AS synchronize" +
" FROM operation" +
" JOIN folder ON folder.id = operation.folder" +
@ -50,7 +50,7 @@ public interface DaoOperation {
" LEFT JOIN account ON account.id = message.account" +
" LEFT JOIN identity ON identity.id = message.identity" +
" WHERE operation.folder = :folder" +
" AND (account.synchronize IS NULL OR account.synchronize)" +
" AND (account.synchronize IS NULL OR account.synchronize)" + // including on demand
" AND (NOT folder.account IS NULL OR identity.synchronize IS NULL OR identity.synchronize)" +
" ORDER BY" +
" CASE WHEN operation.name = '" + EntityOperation.SYNC + "' THEN" +