Commit 69ea35c0 authored by Matija Obreza's avatar Matija Obreza

Merge branch 'UI-614-excluding-option-isn-t-displayed-after-applying-filters-2' into 'master'

Fixed  NOT filter for AccessionFilter#storage

See merge request genesys-pgr/genesys-server!503
parents e4026b0f 405779d0
......@@ -283,7 +283,7 @@ public class AccessionFilter extends UuidModelFilter<AccessionFilter, Accession>
predicates.add(accession.sampStat.isNotNull().and(accession.sampStat.in(sampStat)));
}
if (CollectionUtil.isNotEmpty(storage)) {
predicates.add(accession.accessionId.storage.isNotEmpty().and(accession.accessionId.storage.any().in(storage)));
predicates.add(accession.accessionId.storage.size().gt(0).and(accession.accessionId.storage.any().in(storage)));
}
if (countryOfOrigin != null) {
predicates.addAll(countryOfOrigin.collectPredicates(accession.countryOfOrigin));
......
......@@ -72,7 +72,7 @@ public class EsQueryTest {
QueryBuilder esQuery = visitor.getQuery();
LOG.debug("ES query: {}", visitor.getQuery());
JSONArray storages = JsonPath.read(esQuery.toString(), "bool.filter[*].terms.storage");
JSONArray storages = JsonPath.read(esQuery.toString(), "bool.filter[*].bool.filter[*].terms.storage");
assertThat(storages.get(0), notNullValue());
assertThat(((List<?>) storages.get(0)), hasSize(1));
assertThat(((List<?>) storages.get(0)), containsInAnyOrder(30));
......@@ -88,7 +88,7 @@ public class EsQueryTest {
QueryBuilder esQuery = visitor.getQuery();
LOG.debug("ES query: {}", visitor.getQuery());
JSONArray storages = JsonPath.read(esQuery.toString(), "bool.filter[*].terms.storage");
JSONArray storages = JsonPath.read(esQuery.toString(), "bool.filter[*].bool.filter[*].terms.storage");
assertThat(storages.get(0), notNullValue());
assertThat(((List<?>) storages.get(0)), hasSize(2));
assertThat(((List<?>) storages.get(0)), containsInAnyOrder(20, 10));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment