Skip to content

Commit

Permalink
Merge pull request #1387 from OpenSRP/lmh_child_register
Browse files Browse the repository at this point in the history
Fixes lmh child register query
  • Loading branch information
paulinembabu authored Oct 5, 2020
2 parents 3095987 + a324c0f commit 9850f23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ public String childNavigationMenuCountString() {
" and (SELECT is_closed FROM ec_family_member WHERE base_entity_id = ec_child.mother_entity_id ) = 1)) \n" +
" and CASE WHEN ec_child.gender = 'Male' \n" +
" THEN (\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < +1.8) OR ( (((( julianday('now') - julianday(ec_child.dob))/365.25) >= +1.8) AND ((( julianday('now') - julianday(ec_child.dob))/365.25) <= +2)) AND\n" +
" ((SELECT count(*) FROM alerts WHERE alerts.caseID = ec_child.base_entity_id and alerts.status in ('normal','urgent', 'upcoming')) > 0))\n" +
" )\n" +
" (( julianday('now') - julianday(ec_child.dob))/365.25) < 2\n" +
" )\n" +
" WHEN ec_child.gender = 'Female' \n" +
" THEN (\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < +1.8) OR ( (((( julianday('now') - julianday(ec_child.dob))/365.25) >= +1.8) AND ((( julianday('now') - julianday(ec_child.dob))/365.25) <= +2)) AND\n" +
" ((SELECT count(*) FROM alerts WHERE alerts.caseID = ec_child.base_entity_id and alerts.status in ('normal','urgent', 'upcoming')) > 0)) OR (((julianday('now') - julianday(ec_child.dob))/365.25) BETWEEN 9 AND 11)\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < 2) OR (((julianday('now') - julianday(ec_child.dob))/365.25) BETWEEN 9 AND 11)\n" +
" ) END";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ private static String childDueVaccinesFilter(String dateColumn, int age, String
" and (SELECT is_closed FROM ec_family_member WHERE base_entity_id = ec_child.mother_entity_id ) = 1)) " +
" and CASE WHEN ec_child.gender = 'Male' \n" +
" THEN (\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < +1.8) OR ( (((( julianday('now') - julianday(ec_child.dob))/365.25) >= +1.8) AND ((( julianday('now') - julianday(ec_child.dob))/365.25) <= +2)) AND\n" +
" ((SELECT count(*) FROM alerts WHERE alerts.caseID = ec_child.base_entity_id and alerts.status in ('normal','urgent', 'upcoming')) > 0))\n" +
" )\n" +
" WHEN ec_child.gender = 'Female' \n" +
" (( julianday('now') - julianday(ec_child.dob))/365.25) < 2\n" +
" )\n" +
" WHEN ec_child.gender = 'Female' \n" +
" THEN (\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < +1.8) OR ( (((( julianday('now') - julianday(ec_child.dob))/365.25) >= +1.8) AND ((( julianday('now') - julianday(ec_child.dob))/365.25) <= +2)) AND\n" +
" ((SELECT count(*) FROM alerts WHERE alerts.caseID = ec_child.base_entity_id and alerts.status in ('normal','urgent', 'upcoming')) > 0)) OR (((julianday('now') - julianday(ec_child.dob))/365.25) BETWEEN 9 AND 11)\n" +
" ((( julianday('now') - julianday(ec_child.dob))/365.25) < 2) OR (((julianday('now') - julianday(ec_child.dob))/365.25) BETWEEN 9 AND 11)\n" +
" ) END ";
}

Expand Down

0 comments on commit 9850f23

Please sign in to comment.