Commit a9d572b8 authored by Hugo's avatar Hugo
Browse files

await on hydrate&filter

parent dec78695
......@@ -242,17 +242,19 @@ function reduceMonthFunction(acc, x) {
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 keys : " + keys);
log("debug", "Store into keys : " + filterKeys);
data.map(v => {
log("info", "Saving data " + v.load + " for " + v.day + "/" + v.month + "/" + v.year);
});
return hydrateAndFilter(data, doctype, {
keys: keys
}).then(filteredDocuments => {
addData(filteredDocuments, doctype);
});
const filteredDocuments = await hydrateAndFilter(data, doctype, {
keys: filterKeys
})
return await addData(filteredDocuments, doctype)
}
/**
......
Markdown is supported
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