Skip to content

Commit

Permalink
Merge pull request #808 from dhis2/hotbugfixing
Browse files Browse the repository at this point in the history
Hotbugfixing 0.15.5
  • Loading branch information
vgarciabnz authored May 3, 2019
2 parents 1d75f05 + 5e92423 commit ac1d96b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ ext {
buildToolsVersion: "28.0.3",
minSdkVersion : 19,
targetSdkVersion : 28,
versionCode : 129,
versionName : "0.15.4-SNAPSHOT"
versionCode : 130,
versionName : "0.15.5-SNAPSHOT"
]

libraries = [
Expand Down
4 changes: 2 additions & 2 deletions core/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# Properties which are consumed by plugins/gradle-mvn-push.gradle plugin.
# They are used for publishing artifact to snapshot repository.

VERSION_NAME=0.15.4-SNAPSHOT
VERSION_CODE=129
VERSION_NAME=0.15.5-SNAPSHOT
VERSION_CODE=130

GROUP=org.hisp.dhis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static void addSortingClauses(WhereClauseBuilder whereClauseBuilder,
.direction(RepositoryScope.OrderByDirection.ASC).build());
}

WhereClauseBuilder wrapperClause = new WhereClauseBuilder();
do {
List<RepositoryScopeOrderByItem> nextIterationItems = new ArrayList<>();
WhereClauseBuilder subWhereClause = new WhereClauseBuilder();
Expand All @@ -91,10 +92,12 @@ public static void addSortingClauses(WhereClauseBuilder whereClauseBuilder,
nextIterationItems.add(item);
}
}
whereClauseBuilder.appendOrComplexQuery(subWhereClause.build());
wrapperClause.appendOrComplexQuery(subWhereClause.build());
items = nextIterationItems;
}
while (!items.isEmpty());

whereClauseBuilder.appendComplexQuery(wrapperClause.build());
}

private static void addItemOperator(WhereClauseBuilder whereClauseBuilder, RepositoryScopeOrderByItem item,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.hisp.dhis.android.core.arch.repositories.paging.RepositoryDataSource;
import org.hisp.dhis.android.core.arch.repositories.paging.RepositoryPagingConfig;
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScope;
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeFilterItem;
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeHelper;
import org.hisp.dhis.android.core.arch.repositories.scope.RepositoryScopeOrderByItem;
import org.hisp.dhis.android.core.category.CategoryOption;
Expand Down Expand Up @@ -137,22 +138,26 @@ public void get_initial_page_objects_with_two_order_by() {
}

@Test
public void get_after_page_objects_with_order_by() {
public void get_after_page_objects_with_order_by_and_filter() {
when(key.toContentValues()).thenReturn(keyContentValues);
when(keyContentValues.getAsString("_id")).thenReturn("5");
when(keyContentValues.getAsString("code")).thenReturn("key-code");
when(keyContentValues.getAsString("name")).thenReturn("key-name");

RepositoryScope updatedScope = RepositoryScopeHelper.withOrderBy(emptyScope,
RepositoryScope filterScope = RepositoryScopeHelper.withFilterItem(emptyScope,
RepositoryScopeFilterItem.builder().key("program").operator("=").value("'uid'").build());

RepositoryScope updatedScope = RepositoryScopeHelper.withOrderBy(filterScope,
RepositoryScopeOrderByItem.builder().column("code").direction(RepositoryScope.OrderByDirection.DESC).build());
RepositoryScope updatedScope2 = RepositoryScopeHelper.withOrderBy(updatedScope,
RepositoryScopeOrderByItem.builder().column("name").direction(RepositoryScope.OrderByDirection.ASC).build());
RepositoryDataSource<CategoryOption> dataSource = new RepositoryDataSource<>(store, updatedScope2, childrenAppenders);
dataSource.loadAfter(new ItemKeyedDataSource.LoadParams<>(key, 3), initialCallback);
verify(store).selectWhere(
"(code = 'key-code' AND name = 'key-name' AND _id > '5') OR " +
"((code = 'key-code' AND name = 'key-name' AND _id > '5') OR " +
"(code = 'key-code' AND name > 'key-name') OR " +
"(code < 'key-code')",
"(code < 'key-code')) " +
"AND program = 'uid'",
"code DESC, name ASC, _id ASC",
3);
verify(initialCallback).onResult(objects);
Expand Down

0 comments on commit ac1d96b

Please sign in to comment.