Commit a9d572b8 authored by Hugo's avatar Hugo
Browse files

await on hydrate&filter

parent dec78695
...@@ -242,17 +242,19 @@ function reduceMonthFunction(acc, x) { ...@@ -242,17 +242,19 @@ function reduceMonthFunction(acc, x) {
return acc; return acc;
} }
async function storeData(data, doctype, keys) { /**
* Save data in the right doctype db and prevent duplicated keys
*/
async function storeData(data, doctype, filterKeys) {
log("debug", "Store into " + doctype); log("debug", "Store into " + doctype);
log("debug", "Store into keys : " + keys); log("debug", "Store into keys : " + filterKeys);
data.map(v => { data.map(v => {
log("info", "Saving data " + v.load + " for " + v.day + "/" + v.month + "/" + v.year); log("info", "Saving data " + v.load + " for " + v.day + "/" + v.month + "/" + v.year);
}); });
return hydrateAndFilter(data, doctype, { const filteredDocuments = await hydrateAndFilter(data, doctype, {
keys: keys keys: filterKeys
}).then(filteredDocuments => { })
addData(filteredDocuments, doctype); return await addData(filteredDocuments, doctype)
});
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment