multiple resources collapsed into single blueprint

This commit is contained in:
SAM LUDFORD
2019-05-23 11:32:14 +01:00
parent 8f397e395d
commit 9deb5aae3f
4 changed files with 18 additions and 9 deletions

BIN
.env.enc

Binary file not shown.

View File

@@ -12,6 +12,3 @@ script:
- yarn build - yarn build
- yarn lint - yarn lint
- yarn test - yarn test
before_install:
- openssl aes-256-cbc -K $encrypted_36ad509d33c5_key -iv $encrypted_36ad509d33c5_iv
-in .env.enc -out .env -d

View File

@@ -66,11 +66,20 @@ class Fetcher {
const allParts = allUrls.reduce((acc, url) => { const allParts = allUrls.reduce((acc, url) => {
if (url.startsWith(this.id)) { if (url.startsWith(this.id)) {
const parts = url.split('/') const parts = url.split('/')
acc.push([ parts[1], parts[2] ]) let duplicateTab = acc.reduce((tabFound, p) => {
return acc return tabFound || p[0] === parts[1]
} else { }, false)
return acc if (duplicateTab) {
acc.forEach(p => {
if (p[0] === parts[1]) {
p[1].push(parts[2])
}
})
} else {
acc.push([ parts[1], [ parts[2] ] ])
}
} }
return acc
}, []) }, [])
return allParts return allParts

View File

@@ -15,12 +15,15 @@ export const defaultResource = {
data: [] data: []
} }
export function buildDesaturated (sheetId, sheetName, tab, resource) { export function buildDesaturated (sheetId, sheetName, tab, resources) {
const bp = R.clone(defaultBlueprint) const bp = R.clone(defaultBlueprint)
bp.sheet.name = sheetName bp.sheet.name = sheetName
bp.sheet.id = sheetId bp.sheet.id = sheetId
bp.name = tab bp.name = tab
bp.resources[resource] = null bp.resources = resources.reduce((acc, r) => {
acc[r] = null
return acc
}, {})
return bp return bp
} }