Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix advanced search for non active children #1201

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<artifactId>opensrp-server-web</artifactId>
<packaging>war</packaging>
<version>3.2.11-SNAPSHOT</version>
<version>3.2.12-SNAPSHOT</version>
<name>opensrp-server-web</name>
<description>OpenSRP Server Web Application</description>
<url>https://github.com/OpenSRP/opensrp-server-web</url>
Expand All @@ -25,7 +25,7 @@
<redis.lettuce.version>6.1.6.RELEASE</redis.lettuce.version>
<opensrp.updatePolicy>always</opensrp.updatePolicy>
<nexus-staging-maven-plugin.version>1.5.1</nexus-staging-maven-plugin.version>
<opensrp.core.version>3.2.8-SNAPSHOT</opensrp.core.version>
<opensrp.core.version>3.2.10-SNAPSHOT</opensrp.core.version>
<opensrp.connector.version>2.4.1-SNAPSHOT</opensrp.connector.version>
<opensrp.interface.version>2.0.1-SNAPSHOT</opensrp.interface.version>
<powermock.version>2.0.5</powermock.version>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/org/opensrp/web/utils/SearchHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static SearchEntityWrapper childSearchParamProcessor(HttpServletRequest r
String BIRTH_DATE = "birth_date";

//Attributes
String ACTIVE = "active";
String INACTIVE = "inactive";
String LOST_TO_FOLLOW_UP = "lost_to_follow_up";
String NFC_CARD_IDENTIFIER = "nfc_card_identifier";
Expand All @@ -57,6 +58,7 @@ public static SearchEntityWrapper childSearchParamProcessor(HttpServletRequest r
searchBean.setLastName(RestUtils.getStringFilter(LAST_NAME, request));
searchBean.setGender(RestUtils.getStringFilter(GENDER, request));

String active = RestUtils.getStringFilter(ACTIVE, request);
String inActive = RestUtils.getStringFilter(INACTIVE, request);
String lostToFollowUp = RestUtils.getStringFilter(LOST_TO_FOLLOW_UP, request);
String nfcCardIdentifier = RestUtils.getStringFilter(NFC_CARD_IDENTIFIER, request);
Expand Down Expand Up @@ -85,8 +87,12 @@ public static SearchEntityWrapper childSearchParamProcessor(HttpServletRequest r
}

Map<String, String> attributes = new HashMap<String, String>();
if (!StringUtils.isBlank(inActive) || !StringUtils.isBlank(lostToFollowUp)
|| !StringUtils.isBlank(nfcCardIdentifier)) {
if (!StringUtils.isBlank(active) || !StringUtils.isBlank(inActive)
|| !StringUtils.isBlank(lostToFollowUp) || !StringUtils.isBlank(nfcCardIdentifier)) {

if (!StringUtils.isBlank(active)) {
attributes.put(ACTIVE, active);
}

if (!StringUtils.isBlank(inActive)) {
attributes.put(INACTIVE, inActive);
Expand All @@ -101,6 +107,7 @@ public static SearchEntityWrapper childSearchParamProcessor(HttpServletRequest r
}
}


searchBean.setIdentifiers(identifiers);
searchBean.setAttributes(attributes);

Expand Down