Skip to content

Commit

Permalink
Merge pull request #353 from OpenSRP/persist-pnc-hf-next-visit-date
Browse files Browse the repository at this point in the history
Persist pnc hf next visit date
  • Loading branch information
allan-on authored Oct 28, 2019
2 parents 43d8aba + 64121ee commit e0c1026
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=0.1.19-SNAPSHOT
VERSION_NAME=0.1.20-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client CHW Anc Library
Expand Down
2 changes: 1 addition & 1 deletion opensrp-chw-anc/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
POM_SETTING_NAME=OpenSRP Client Chw Anc
POM_SETTING_ARTIFACT_ID=opensrp-client-chw-anc
POM_SETTING_PACKAGING=aar
VERSION_NAME=0.1.31-SNAPSHOT
VERSION_NAME=0.1.32-SNAPSHOT
VERSION_CODE=1
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,17 @@ public Visit getVisitByFormSubmissionID(String formSubmissionID) {
}

public Visit getLatestVisit(String baseEntityID, String visitType) {
return getLatestVisit(baseEntityID, visitType, null);
}

public Visit getLatestVisit(String baseEntityID, String visitType, SQLiteDatabase sqLiteDatabase) {
if (sqLiteDatabase == null) {
sqLiteDatabase = getReadableDatabase();
}
List<Visit> visits = new ArrayList<>();
Cursor cursor = null;
try {
cursor = getReadableDatabase().query(VISIT_TABLE, VISIT_COLUMNS, BASE_ENTITY_ID + " = ? AND " + VISIT_TYPE + " = ? ", new String[]{baseEntityID, visitType}, null, null, VISIT_DATE + " DESC ", "1");
cursor = sqLiteDatabase.query(VISIT_TABLE, VISIT_COLUMNS, BASE_ENTITY_ID + " = ? AND " + VISIT_TYPE + " = ? ", new String[]{baseEntityID, visitType}, null, null, VISIT_DATE + " DESC ", "1");
visits = readVisits(cursor);
} catch (Exception e) {
Timber.e(e);
Expand Down

0 comments on commit e0c1026

Please sign in to comment.