OpenFn / wcs-wildmeat

Wildlife Conservation Society ConSocSci Project
1 stars 0 forks source link

Convert quantity from kilograms to grams #25

Closed aleksa-krolls closed 3 years ago

aleksa-krolls commented 3 years ago

Request

If state.data.defaultUnit: "kilograms" --> multiply quantity by 1000 to convert kg to grams. This way the massin_grams value will be correct. If state.data.defaultUnit is not defined/ not present in the payload, OR if it does not equal kilograms, then continue to map the Kobo quantity as is https://github.com/OpenFn/wcs-wildmeat/blob/fb6b84974181a46eb9e2a2a3d2eeb2381fc46562/jobs/rural-consumption-to-postgres.js#L90

state

See LP for Wildmeat Postgres Use this: https://www.openfn.org/projects/p5yaxp/messages/mbpqw5qr

adaptor

language-postgresql

expression

https://github.com/OpenFn/wcs-wildmeat/blob/fb6b84974181a46eb9e2a2a3d2eeb2381fc46562/jobs/rural-consumption-to-postgres.js#L90

output

This state should return a massin_grams of 11,000 (11 kg * 1000).