Skip to content

Commit bd9a19d

Browse files
committed
Removed redundant code
1 parent 08902bc commit bd9a19d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

entities/src/main/java/org/odk/collect/entities/javarosa/filter/LocalEntitiesFilterStrategy.kt

+3-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LocalEntitiesFilterStrategy(entitiesRepository: EntitiesRepository) :
4141
val query = xPathExpressionToQuery(predicate, sourceInstance, evaluationContext)
4242

4343
return if (query != null) {
44-
queryToTreeReferences(query, sourceInstance, next)
44+
queryToTreeReferences(query, sourceInstance)
4545
} else {
4646
next.get()
4747
}
@@ -99,20 +99,14 @@ class LocalEntitiesFilterStrategy(entitiesRepository: EntitiesRepository) :
9999
}
100100
}
101101

102-
private fun queryToTreeReferences(
103-
query: Query?,
104-
sourceInstance: DataInstance<*>,
105-
next: Supplier<MutableList<TreeReference>>
106-
): List<TreeReference> {
107-
return if (query != null) {
102+
private fun queryToTreeReferences(query: Query, sourceInstance: DataInstance<*>): List<TreeReference> {
103+
return run {
108104
val results = instanceAdapter.query(sourceInstance.instanceId, query)
109105
sourceInstance.replacePartialElements(results)
110106
results.map {
111107
it.parent = sourceInstance.root
112108
it.ref
113109
}
114-
} else {
115-
next.get()
116110
}
117111
}
118112
}

0 commit comments

Comments
 (0)