OpenFn / unicef-cambodia

UNICEF Cambodia - Primero Interoperability
https://openfn.github.io/unicef-cambodia/
1 stars 2 forks source link

Clean up non-used code in 'V2/f1-j1-getPrimeroCasesV2.js' #102

Closed aleksa-krolls closed 2 years ago

aleksa-krolls commented 2 years ago

Request

See the comments in the code below. It seems like we're logging multiple date values that we are NOT using as the date cursor in this job where we get Cases from Primero. https://github.com/OpenFn/unicef-cambodia/blob/a57d8de22ca20dd112a91920d726b28b2e618343/jobs/V2/f1-j1-getPrimeroCasesV2.js#L19-L30

L14 has the correct cursor, where we should get cases from Primero where c.last_updated_at > lastRunDateTime.

expression

MAKE SURE TO ONLY UPDATE JOB IN V2 FOLDER: https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/V2/f1-j1-getPrimeroCasesV2.js

state

Primero (to generate state):

{
"configuration": "Primero V2 Cambodia Demo API user",
"data": "initialState from previous run"
}

To test

Feel free to run locally or on the Staging platform project: https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/jobs/jywaga

aleksa-krolls commented 2 years ago

@taylordowns2000 @grayey here is the cursor issue we discussed

bearski commented 2 years ago

@aleksa-krolls , @daissatou2 Taylor and I are confident that those cursors were unused. We have updated the job.

Please note that we removed two of those nasty “fn-antipatterns” from the code:

This is the link used for testing:
https://www.openfn.org/projects/primero-oscar-cambodia-io-staging/runs/06248163-4afa-7cad-b0e8-52d274b7062e

Please let us know if you have any questions