From bfb8fabc27a9cf2ac68f5eadc9ffc0749b77225a Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Thu, 28 May 2020 13:50:46 -0500 Subject: [PATCH] Remove unnecessary left join on subtask query --- app/src/main/java/org/tasks/data/TaskListQueryRecursive.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/tasks/data/TaskListQueryRecursive.kt b/app/src/main/java/org/tasks/data/TaskListQueryRecursive.kt index d77c391ee..717345e78 100644 --- a/app/src/main/java/org/tasks/data/TaskListQueryRecursive.kt +++ b/app/src/main/java/org/tasks/data/TaskListQueryRecursive.kt @@ -36,11 +36,10 @@ internal object TaskListQueryRecursive { .join(Join.inner(RECURSIVE, GoogleTask.PARENT.eq(RECURSIVE_TASK))) .join(Join.inner(GoogleTask.TABLE, Criterion.and(GoogleTask.TASK.eq(Task.ID), GoogleTask.DELETED.eq(0)))) .where(activeAndVisible()) - private val GOOGLE_AND_CALDAV_SUBTASKS = + private val ALL_SUBTASKS = QueryTemplate() .join(Join.inner(RECURSIVE, Criterion.or(GoogleTask.PARENT.eq(RECURSIVE_TASK), Task.PARENT.eq(RECURSIVE_TASK)))) .join(Join.left(GoogleTask.TABLE, Criterion.and(GoogleTask.TASK.eq(Task.ID), GoogleTask.DELETED.eq(0)))) - .join(Join.left(CaldavTask.TABLE, Criterion.and(CaldavTask.TASK.eq(Task.ID), CaldavTask.DELETED.eq(0)))) .where(activeAndVisible()) fun getRecursiveQuery(filter: Filter, preferences: Preferences, subtasks: SubtaskInfo): List { @@ -63,7 +62,7 @@ internal object TaskListQueryRecursive { else -> { parentQuery = PermaSql.replacePlaceholdersForQuery(filter.getSqlQuery()) subtaskQuery = when { - subtasks.hasGoogleSubtasks && subtasks.hasSubtasks -> GOOGLE_AND_CALDAV_SUBTASKS + subtasks.hasGoogleSubtasks && subtasks.hasSubtasks -> ALL_SUBTASKS subtasks.hasGoogleSubtasks -> GOOGLE_SUBTASKS else -> QueryTemplate() .join(Join.inner(RECURSIVE, Task.PARENT.eq(RECURSIVE_TASK)))