Skip to content

Commit

Permalink
change in response to rolands pr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Jul 12, 2024
1 parent 0fe19e3 commit 7901b6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/controllers/LpaOverviewController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import performanceDbApi from '../services/performanceDbApi.js' // Assume you have an API service module
import logger from '../utils/logger.js'

const LpaOverviewController = {
async getOverview (req, res, next) {
Expand All @@ -12,9 +13,12 @@ const LpaOverviewController = {
return { ...value, slug: key }
})
const totalDatasets = datasets.length
const datasetsWithEndpoints = datasets.filter(item => item.endpoint !== null).length
const datasetsWithIssues = datasets.filter(item => item.issue).length
const datasetsWithErrors = datasets.filter(item => item.error).length
const [datasetsWithEndpoints, datasetsWithIssues, datasetsWithErrors] = datasets.reduce((accumulator, dataset) => {
if (dataset.endpoint !== null) accumulator[0]++
if (dataset.issue) accumulator[1]++
if (dataset.error) accumulator[2]++
return accumulator
}, [0, 0, 0])

const params = {
organisation: {
Expand All @@ -29,6 +33,7 @@ const LpaOverviewController = {

res.render('manage/lpa-overview.html', params)
} catch (error) {
logger.error(error)
next(error)
}
}
Expand Down

0 comments on commit 7901b6f

Please sign in to comment.