Skip to content

Commit

Permalink
🐛 Fix WashCheck visits NULL pre-processed value
Browse files Browse the repository at this point in the history
  • Loading branch information
allan-on committed May 24, 2022
1 parent 0f2b3a4 commit 5b4fb62
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.smartregister.chw.model;

import com.google.gson.Gson;

import org.smartregister.chw.anc.AncLibrary;
import org.smartregister.chw.anc.domain.Visit;
import org.smartregister.chw.anc.domain.VisitDetail;
Expand Down Expand Up @@ -27,6 +29,7 @@ public boolean saveWashCheckEvent(String jsonString) {
baseEvent.setBaseEntityId(familyId);

Visit visit = NCUtils.eventToVisit(baseEvent);
visit.setPreProcessedJson(new Gson().toJson(baseEvent));
AncLibrary.getInstance().visitRepository().addVisit(visit);
for (Map.Entry<String, List<VisitDetail>> entry : visit.getVisitDetails().entrySet()) {
if (entry.getValue() != null) {
Expand All @@ -35,13 +38,6 @@ public boolean saveWashCheckEvent(String jsonString) {
}
}
}
/* if (ChwApplication.getApplicationFlavor().launchWashCheckOnNativeForm()) {
// delete any previous wash check event
List<String> visitIds = WashCheckDao.getLastWashCheckVisitId(familyId);
for (int i = 0; i < visitIds.size() - 1; i++) {
AncLibrary.getInstance().visitRepository().deleteVisit(visitIds.get(i));
}
} */
NCUtils.addEvent(allSharedPreferences, baseEvent);
NCUtils.startClientProcessing();
return true;
Expand Down

0 comments on commit 5b4fb62

Please sign in to comment.