OpenFn / grassroot-soccer

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

Update Register Participant job to handle state files that have no participants #20

Closed daissatou2 closed 3 years ago

daissatou2 commented 3 years ago

Describe the bug

The Register Participant form in CommCare can be submitted without any new participants listed. When we receive a message where 'form.question1` is undefined (i.e not in the message), nothing should be upserted. The job should exit and return the statement "Nothing to upsert. No participants were registered".

To Reproduce

  1. Here is a link to a failed run on OpenFn.org which is indicative of the bug: https://www.openfn.org/projects/pd3yk4/runs/rrk36bm4

expression.js

Link to the job itself in Github: https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/2.d.upsertRegisterParticipant.js

state.json

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

Expected behavior

Even though nothing will be upserted, the job should pass for this state.

To test/resolve

  1. After the desired output is working locally (from the CLI), please [push commits to master || open a pull request].
  2. [Please test the change on OpenFn.org by re-running this run (https://www.openfn.org/projects/pd3yk4/runs/rrk36bm4) and confirming success.]
aleksa-krolls commented 3 years ago

@lakhassane adding to bottom of backlog... when you get to it, let @daissatou2 know if you have questions.

lakhassane commented 3 years ago

@daissatou2 corrections done: https://www.openfn.org/projects/pd3yk4/runs/r9wbza95