Skip to content
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
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.8.0-SNAPSHOT
VERSION_NAME=0.8.1-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Child Library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,18 +819,25 @@ public static Event addMetaData(Context context, Event event, Date start) {
return event;
}

/**
* Tag an event with metadata fields LocationId, ChildLocationId, Data strategy in use, Team, TeamId, Database Version and Client App Version
*
* @param event to tag
* @return Tagged event
*/
public static Event tagSyncMetadata(@NonNull Event event) {
return tagSyncMetadata(event, null);
}

/**
* Tag an event with metadata fields LocationId, ChildLocationId, Data strategy in use, Team, TeamId, Database Version and Client App Version
*
* @param event to tag
* @param locationId for event
* @return Tagged event
*/
public static Event tagSyncMetadata(@NonNull Event event, String locationId) {
AllSharedPreferences allSharedPreferences = Utils.getAllSharedPreferences();
String providerId = allSharedPreferences.fetchRegisteredANM();
event.setProviderId(providerId);
event.setLocationId(getProviderLocationId(ChildLibrary.getInstance().context().applicationContext()));
if (locationId != null) {
event.setLocationId(locationId);
} else
event.setLocationId(getProviderLocationId(ChildLibrary.getInstance().context().applicationContext()));

String childLocationId = getChildLocationId(allSharedPreferences.fetchDefaultLocalityId(providerId), allSharedPreferences);
event.setChildLocationId(childLocationId);
Expand Down Expand Up @@ -965,7 +972,7 @@ public static ChildEventClient processChildDetailsForm(String jsonString, FormTa
}
}

ChildJsonFormUtils.tagSyncMetadata(baseEvent);// tag docs
ChildJsonFormUtils.tagSyncMetadata(baseEvent, getFieldValue(fields, Constants.HOME_FACILITY));// tag docs

//Add previous relational ids if they existed.
addRelationships(baseClient, jsonString);
Expand Down