Skip to content

Commit

Permalink
If material is not distributed (quantity is 0) it should not be passe…
Browse files Browse the repository at this point in the history
…d on to salesforce.
  • Loading branch information
himeshr committed Sep 15, 2022
1 parent 058c4e4 commit 88d480c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ private String getPicSignedUrl(String photoInfo) {

private List<DistributionLine> fetchDistributionLines(Subject subject, GeneralEncounter encounter) {
ArrayList<HashMap<String, Object>> md = (ArrayList<HashMap<String, Object>>) encounter.getObservations().get(MATERIALS);
return md.stream().map(entry -> createDistributionLine(subject, encounter, entry)).collect( Collectors.toList());
return md.stream().filter(entry -> entry.get(QUANTITY) != null && ((Integer) entry.get(QUANTITY)) > 0)
.map(entry -> createDistributionLine(subject, encounter, entry)).collect( Collectors.toList());
}

private DistributionLine createDistributionLine(Subject subject, GeneralEncounter encounter, HashMap<String, Object> entry) {
Expand Down

0 comments on commit 88d480c

Please sign in to comment.