Skip to content

Commit

Permalink
update to show all available datasets and include 8 essential ones
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Jul 12, 2024
1 parent 8511c19 commit 3434d83
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/controllers/LpaOverviewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@ const LpaOverviewController = {
// Make API request
const lpaOverview = await performanceDbApi.getLpaOverview(lpa)

const datasets = availableDatasets.map((dataset) => ({
slug: dataset,
...(lpaOverview.datasets[dataset] || { endpoint: null })
}))
// restructure datasets to usable format
const datasets = Object.entries(lpaOverview.datasets).map(([key, value]) => {
return {
slug: key,
...value
}
})

// add in any of the missing key 8 datasets
const keys = Object.keys(lpaOverview.datasets)
availableDatasets.forEach(dataset => {
if (!keys.includes(dataset)) {
datasets.push({
slug: dataset,
endpoint: null
})
}
})

const totalDatasets = datasets.length
const [datasetsWithEndpoints, datasetsWithIssues, datasetsWithErrors] = datasets.reduce((accumulator, dataset) => {
Expand Down

0 comments on commit 3434d83

Please sign in to comment.