OpenFn / grassroot-soccer

Grassroot Soccer CommCare-Salesforce integrations
https://openfn.github.io/grassroot-soccer/
0 stars 0 forks source link

Update Risk & Vulnerability Assessment | Service Referral and Upsert Service Referral jobs to handle state files that have no service referrals #23

Closed daissatou2 closed 3 years ago

daissatou2 commented 3 years ago

Background, context, and business value

The Risk & Vulnerability Assessment | Service Referral and Upsert Service Referral forms in CommCare can be submitted without any new service referrals selected. When we receive a message with no service referrals selected, the job should gracefully exit and not attempt to upsert a referral.

The specific request, in as few words as possible

When we receive a message where form.subcase_0 is empty (i.e "subcase_0": ""), no referral should be upserted. The job should return the statement "No referral services to upsert."

See #17 and #2 for the original issues on these jobs. Currently the job as-is fails because it is trying to map undefined fields.

state.json

https://www.openfn.org/projects/pd3yk4/messages/mk5awk4r

output.json

Test by rerunning this transaction: https://www.openfn.org/projects/pd3yk4/runs/rwap65an

aleksa-krolls commented 3 years ago

@daissatou2 moving to backlog, thanks!

lakhassane commented 3 years ago

@daissatou2 I made the change and re-run the transaction: https://www.openfn.org/projects/pd3yk4/runs/rrk7nk7d

I made the same logic for upsertServiceReferrals