Skip to content

Commit

Permalink
Merge pull request #540 from digital-land/hotfix/handle-missing-mappi…
Browse files Browse the repository at this point in the history
…ng-fields

Gracefully handles missing mapping fields
  • Loading branch information
DilwoarH authored Oct 10, 2024
2 parents dc1a8ca + e803a34 commit bea4c00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ const fetchEntityCount = fetchOne({
export const prepareDatasetOverviewTemplateParams = (req, res, next) => {
const { orgInfo, specification, columnSummary, entityCount, sources, dataset, issues } = req

const mappingFields = columnSummary[0].mapping_field?.split(';') ?? []
const nonMappingFields = columnSummary[0].non_mapping_field?.split(';') ?? []
const mappingFields = columnSummary[0]?.mapping_field?.split(';') ?? []
const nonMappingFields = columnSummary[0]?.non_mapping_field?.split(';') ?? []
const allFields = [...mappingFields, ...nonMappingFields]

const numberOfFieldsSupplied = specification.fields.map(field => field.field).reduce((acc, current) => {
Expand Down

0 comments on commit bea4c00

Please sign in to comment.