fix differential args for fetchers

This commit is contained in:
Lachlan Kermode
2020-04-26 17:17:34 +02:00
parent f34b9224aa
commit d113181bb4
3 changed files with 21 additions and 11 deletions

View File

@@ -15,10 +15,15 @@ export default callback => {
// skip config attrs that don't have corresponding fetchers // skip config attrs that don't have corresponding fetchers
if (!(fType in fetchers)) return null if (!(fType in fetchers)) return null
const FFetcher = fetchers[fType] const FFetcher = fetchers[fType]
return config[fType].map(sheet => ({ return config[fType].map(sheet => {
name: sheet.name, const otherArgs = { ...sheet }
fetcher: new FFetcher(new StoreJson(), ...Object.values(sheet)) delete otherArgs.name
})) delete otherArgs.tabs
return {
name: sheet.name,
fetcher: new FFetcher(new StoreJson(), sheet.name, sheet.tabs, ...Object.values(otherArgs))
}
})
}) })
}) })
.then(res => { .then(res => {

View File

@@ -22,7 +22,6 @@ class Controller {
update () { update () {
return Promise.all( return Promise.all(
Object.keys(this.fetchers).map(sheet => { Object.keys(this.fetchers).map(sheet => {
console.log(sheet)
return this.fetchers[sheet].update() return this.fetchers[sheet].update()
}) })
).then(results => { ).then(results => {

View File

@@ -1,18 +1,24 @@
import BP from './lib/blueprinters' import BP from './lib/blueprinters'
const timemapStructure = { const timemapStructure = {
teuruwera_export_events: BP.deeprows, export_events: BP.deeprows,
teuruwera_export_categories: [BP.groups, BP.rows], export_categories: [BP.groups, BP.rows],
export_narratives: BP.rows, export_narratives: BP.rows,
teuruwera_export_sources: BP.deepids, export_sources: BP.deepids,
export_sites: BP.rows, export_sites: BP.rows,
export_tags: BP.tree export_tags: BP.tree
} }
export default { export default {
gsheets: [{ gsheets: [{
name: 'example', name: 'nzacts',
id: '1UC7DkCFeUXHfpUxUGruExwFbP4pqVBdJLOKfo6wDDGk', tabs: timemapStructure,
tabs: timemapStructure id: '1ej3kEtANGYsEBUCTfWsIR0UhTSJIuXFHLYspti2sgHo'
}],
xlsx: [{
name: 'morocco_pushbacks',
tabs: timemapStructure,
path: 'temp/morocco_pushbacks.xlsx'
}] }]
} }