Skip to content

Commit

Permalink
Merge pull request #308 from OpenSRP/lmh_QA_bug_fixes
Browse files Browse the repository at this point in the history
Changes the access on methods
  • Loading branch information
paulinembabu authored Oct 14, 2020
2 parents 565db1f + f6a8994 commit f31964a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public static List<Child> getFamilyChildren(String familyBaseEntityID) {
return values;
}

public static Child getChild(String baseEntityID) {
String sql = "select c.base_entity_id , c.first_name , c.last_name , c.middle_name , c.mother_entity_id , c.relational_id , c.dob , c.date_created , lastVisit.last_visit_date , last_visit_not_done_date " +
public static String getChildQuery(String baseEntityID){
return "select c.base_entity_id , c.first_name , c.last_name , c.middle_name , c.mother_entity_id , c.relational_id , c.dob , c.date_created , lastVisit.last_visit_date , last_visit_not_done_date " +
"from ec_child c " +
"inner join ec_family_member m on c.base_entity_id = m.base_entity_id COLLATE NOCASE " +
"inner join ec_family f on f.base_entity_id = m.relational_id COLLATE NOCASE " +
Expand All @@ -77,6 +77,10 @@ public static Child getChild(String baseEntityID) {
"and m.date_removed is null and m.is_closed = 0 " +
"and ((( julianday('now') - julianday(c.dob))/365.25) < 5) and c.is_closed = 0 " +
" and (( ( ifnull(entry_point,'') <> 'PNC' ) ) or (ifnull(entry_point,'') = 'PNC' and ( date (c.dob, '+28 days') <= date() and ((SELECT is_closed FROM ec_family_member WHERE base_entity_id = mother_entity_id ) = 0))) or (ifnull(entry_point,'') = 'PNC' and (SELECT is_closed FROM ec_family_member WHERE base_entity_id = mother_entity_id ) = 1)) ";
}

public static Child getChild(String baseEntityID) {
String sql = getChildQuery(baseEntityID);

List<Child> values = AbstractDao.readData(sql, getChildDataMap());
if (values == null || values.size() != 1)
Expand All @@ -85,7 +89,8 @@ public static Child getChild(String baseEntityID) {
return values.get(0);
}

private static DataMap<Child> getChildDataMap() {

public static DataMap<Child> getChildDataMap() {
return c -> {
Child record = new Child();
record.setBaseEntityID(getCursorValue(c, "base_entity_id"));
Expand Down

0 comments on commit f31964a

Please sign in to comment.