diff --git a/pom.xml b/pom.xml index 7d897442e..906ca1c8c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ opensrp-server-core jar - 3.2.9-SNAPSHOT + 3.2.10-SNAPSHOT opensrp-server-core OpenSRP Server Core module https://github.com/OpenSRP/opensrp-server-core diff --git a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml index dec37783a..acf70cb40 100644 --- a/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml +++ b/src/main/java/org/opensrp/repository/postgres/mapper/custom/xml/CustomClientMetadataMapper.xml @@ -336,12 +336,33 @@ - - - - json -> 'attributes' ->> #{key,jdbcType=VARCHAR} = #{value,jdbcType=VARCHAR} - - + + + + + (json->'attributes'->>'inactive' IS NOT NULL + AND COALESCE(json->'attributes'->>'lost_to_follow_up', 'false') = 'false') + AND + + + + (json->'attributes'->>'active' is null and COALESCE(json->'attributes'->>'inactive', 'false') = 'false' + AND COALESCE(json->'attributes'->>'lost_to_follow_up', 'false') = 'false') + + + (json->'attributes'->>'active' is null and json->'attributes'->>'inactive' = 'true' + OR json->'attributes'->>'lost_to_follow_up' = 'true') + + OR + + + (json->'attributes'->>'lost_to_follow_up' IS NOT NULL + AND COALESCE(json->'attributes'->>'inactive', 'false') = 'false') + AND + + json -> 'attributes' ->> #{key,jdbcType=VARCHAR} = #{value,jdbcType=VARCHAR} + + and cm.location_id IN