From 99235f0e8ffd3848e8eaa6f289146cbbaad6c01c Mon Sep 17 00:00:00 2001 From: George Goodall Date: Thu, 12 Dec 2024 16:02:08 +0000 Subject: [PATCH] dont group issues as doing it in the query --- src/middleware/datasetTaskList.middleware.js | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/middleware/datasetTaskList.middleware.js b/src/middleware/datasetTaskList.middleware.js index 19df1407..868f84d3 100644 --- a/src/middleware/datasetTaskList.middleware.js +++ b/src/middleware/datasetTaskList.middleware.js @@ -60,22 +60,7 @@ export const prepareTasks = (req, res, next) => { const issues = [...entryIssueCounts, ...entityIssueCounts] - const groupedIssues = issues.reduce((acc, issue) => { - const { field, issue_type: type } = issue - const key = `${field}_${type}` - if (acc[key]) { - acc[key].count += 1 - } else { - acc[key] = { - type, - field, - count: 1 - } - } - return acc - }, {}) - - req.taskList = Object.values(groupedIssues).map(({ field, type, count }) => { + req.taskList = Object.values(issues).map(({ field, issue_type: type, count }) => { // if the issue doesn't have an entity, or is one of the special case issue types then we should use the resource_row_count let rowCount = entityCount