Skip to content

Commit

Permalink
Fix bug with issue count not showing on overview page
Browse files Browse the repository at this point in the history
During the migration of middleware, we somehow managed to cause this feature to be lost.

#500
  • Loading branch information
DilwoarH committed Oct 8, 2024
1 parent a462584 commit 9bf692f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const fetchEntityCount = fetchOne({
})

export const prepareDatasetOverviewTemplateParams = (req, res, next) => {
const { orgInfo, specification, columnSummary, entityCount, sources, dataset } = req
const { orgInfo, specification, columnSummary, entityCount, sources, dataset, issues } = req

const mappingFields = columnSummary[0].mapping_field?.split(';') ?? []
const nonMappingFields = columnSummary[0].non_mapping_field?.split(';') ?? []
Expand Down Expand Up @@ -89,6 +89,7 @@ export const prepareDatasetOverviewTemplateParams = (req, res, next) => {
req.templateParams = {
organisation: orgInfo,
dataset,
issueCount: issues.length ?? 0,

Check failure on line 92 in src/middleware/datasetOverview.middleware.js

View workflow job for this annotation

GitHub Actions / run-tests / test

test/unit/middleware/datasetOverview.middleware.test.js > Dataset Overview Middleware > prepareDatasetOverviewTemplateParams > should prepare template params for dataset overview

TypeError: Cannot read properties of undefined (reading 'length') ❯ Module.prepareDatasetOverviewTemplateParams src/middleware/datasetOverview.middleware.js:92:24 ❯ test/unit/middleware/datasetOverview.middleware.test.js:46:7
stats: {
numberOfFieldsSupplied: numberOfFieldsSupplied ?? 0,
numberOfFieldsMatched: numberOfFieldsMatched ?? 0,
Expand Down
1 change: 1 addition & 0 deletions src/routes/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const OrgGetStarted = v.strictObject({
export const OrgDatasetOverview = v.strictObject({
organisation: OrgField,
dataset: DatasetNameField,
issueCount: v.integer(),
stats: v.strictObject({
numberOfRecords: v.integer(),
numberOfFieldsSupplied: v.integer(),
Expand Down

0 comments on commit 9bf692f

Please sign in to comment.