OpenFn / grassroot-soccer

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

Missing mappings in Register Participant job - return whichever value is present #14

Closed daissatou2 closed 3 years ago

daissatou2 commented 3 years ago

Describe the bug

There are two versions of the Register Participant form. The Upsert Register Participant job should be able to handle both versions of the form. I.e the job should recognize both paths for one particular field.

Ex. form.question1.participant_first_name & form.new_participants.participant_first_name should both map to First_Name__c.

Currently, the Skillz Plus Club version isn't working. In the mapping sheet, this version is noted at the bottom.

expression.js

https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/2.d.upsertRegisterParticipant.js

state.json

Skillz plus club version (currently failing): https://www.openfn.org/projects/pd3yk4/messages/m6645zqa General version (currently passing): https://www.openfn.org/projects/pd3yk4/runs/r6gedrxw

Expected behavior

When a user submits either the Skillz Plus Club Register Participants form or the General Register Participant form, the Upsert Register Participant job should be able to successfully sync.

To test/resolve

  1. Please test the change on OpenFn.org by re-running this run and confirming success.
taylordowns2000 commented 3 years ago

While moving new_participants into a question1 array definitely sounds like it needed to be done*, it doesn't resolve the Cannot read property '@case_id' of undefined error. I'll take a look at that next.

* @daissatou2 , have I interpreted this correctly? See implementation.

aleksa-krolls commented 3 years ago

@taylordowns2000 the case_id path is new_participants[*].create_skillz_plus_participant.case.@case_id so looks like just need to add create_skillz_plus_participant to the path? Or is it more complicated b/c the operation is within the each(...)? image

taylordowns2000 commented 3 years ago

This is a separate issue but was resolved over here: https://github.com/OpenFn/grassroot-soccer/issues/15

Thank you for the mapping!

aleksa-krolls commented 3 years ago

@daissatou2 @taylordowns2000 can we close this issue?