Open
Description
Needs fixing alongside the latest release
Look at this:
fn(state => {
console.log('Current cursor value:', state.lastEnd);
// Set a manual cursor if you'd like to only fetch data after this date.
const manualCursor = '2020-11-20T14:32:43.325+01:00';
state.data = {
surveys: [
//** Specify new forms to fetch here **//
{
id: 'aVdh90L9979L945lb02',
name: 'Initial Data Collection',
},
{
id: 'bkgIF96fK7v9n7Hfj2',
name: 'Follow-up',
},
].map(survey => ({
formId: survey.id,
name: survey.name,
url: `https://kf.kobotoolbox.org/api/v2/assets/${survey.id}/data/?format=json`,
query: `&query={"end":{"$gte":"${state.lastEnd || manualCursor}"}}`,
})),
};
return state;
});
each(dataPath('surveys[*]'), state => {
const { url, query, formId, name } = state.data;
return get(`${url}${query}`, {}, state => {
state.data.submissions = state.data.results.map((submission, i) => {
return {
i,
// Here we append the names defined above to the Kobo form submission data
formName: name,
};
});
});
});
Metadata
Metadata
Assignees
Type
Projects
Status