From de401571cf8fcc50b2cbbd90e8b4a652565d1654 Mon Sep 17 00:00:00 2001 From: Dilwoar Hussain Date: Mon, 7 Oct 2024 09:29:59 +0100 Subject: [PATCH 1/5] Fixes typo - changes `vou` to `you` --- src/views/errorPages/400.html | 2 +- src/views/errorPages/404.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/errorPages/400.html b/src/views/errorPages/400.html index e8fd715e..883d3738 100644 --- a/src/views/errorPages/400.html +++ b/src/views/errorPages/400.html @@ -11,7 +11,7 @@

{{pageName}}

If you pasted the web address, check you copied the entire address.

-

If the web address is correct or vou selected a link or button send an email +

If the web address is correct or you selected a link or button send an email to digitalland@communities.gov.uk.

diff --git a/src/views/errorPages/404.html b/src/views/errorPages/404.html index 7a5abb8b..dc158056 100644 --- a/src/views/errorPages/404.html +++ b/src/views/errorPages/404.html @@ -11,7 +11,7 @@

{{pageName}}

If you pasted the web address, check you copied the entire address.

-

If the web address is correct or vou selected a link or button send an email +

If the web address is correct or you selected a link or button send an email to digitalland@communities.gov.uk.

From 629fb0a4ffb1f87c62761d56088158fef251c2f8 Mon Sep 17 00:00:00 2001 From: stevenjmesser Date: Mon, 7 Oct 2024 13:53:52 +0000 Subject: [PATCH 2/5] Fix typo, change link --- src/views/privacy-notice.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/privacy-notice.html b/src/views/privacy-notice.html index 6bc060d6..1edfd445 100644 --- a/src/views/privacy-notice.html +++ b/src/views/privacy-notice.html @@ -9,7 +9,7 @@ ## Who we are -Check planning and housing data for England ([check.planning.data.go.uk](check.planning.data.go.uk)) is provided by the Ministry of Housing, Communities and Local Government (MHCLG). +Check planning and housing data for England ([submit.planning.data.gov.uk](https://submit.planning.data.gov.uk)) is provided by the Ministry of Housing, Communities and Local Government (MHCLG). MHCLG is the data controller for the service. From 17e6b7114f1d7513af8adcb9b6bab7291cb6bb24 Mon Sep 17 00:00:00 2001 From: stevenjmesser Date: Mon, 7 Oct 2024 16:22:39 +0000 Subject: [PATCH 3/5] Update the service name in other places too --- readme.md | 2 +- src/views/accessibility.html | 6 +++--- src/views/cookies.html | 12 ++++++------ src/views/privacy-notice.html | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/readme.md b/readme.md index 7d1fdcf6..8fbba153 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Check planning and housing data for England +# Submit and update planning and housing data for England Project is a web application for validating and submitting planning and housing data for England. diff --git a/src/views/accessibility.html b/src/views/accessibility.html index ddf2bd04..65113ad3 100644 --- a/src/views/accessibility.html +++ b/src/views/accessibility.html @@ -1,12 +1,12 @@ {% extends "layouts/main.html" %} -{% set pageName = 'Accessibility statement for check planning and housing data for England' %} +{% set pageName = 'Accessibility statement for Submit and update planning and housing data for England' %} {% set markdownContent %} -# Accessibility statement for check planning and housing data for England +# Accessibility statement for Submit and update planning and housing data for England -This accessibility statement applies to the check planning and housing data for England service (publish.development.digital-land.info). +This accessibility statement applies to the Submit and update planning and housing data for England service (publish.development.digital-land.info). This service is run by the Ministry of Housing, Communities and Local Government (MHCLG). We want as many people as possible to be able to use this service. For example, that means you should be able to: diff --git a/src/views/cookies.html b/src/views/cookies.html index fce09ec2..b626585d 100644 --- a/src/views/cookies.html +++ b/src/views/cookies.html @@ -1,12 +1,12 @@ {% extends "layouts/main.html" %} -{% set pageName = 'Accessibility statement for check planning and housing data for England' %} +{% set pageName = 'Accessibility statement for Submit and update planning and housing data for England' %} {% set markdownContent %} -# Check planning and housing data for England cookies notice +# Submit and update planning and housing data for England cookies notice -The Check planning and housing data for England service puts cookies onto your computer to collect information about how you use the service. This helps us to: +The Submit and update planning and housing data for England service puts cookies onto your computer to collect information about how you use the service. This helps us to: @@ -21,16 +21,16 @@ Essential cookies are needed for the service to work. We do not need to ask for permission to use them. -## How cookies are used on the Check planning and housing data for England service +## How cookies are used on the Submit and update planning and housing data for England service ### Our cookie banner (essential) -When you first visit the Check planning and housing data for England service, you will see a banner asking if you accept cookies. We’ll store a cookie to remember which option you selected. You can always change your mind and change your choice on this page. +When you first visit the Submit and update planning and housing data for England service, you will see a banner asking if you accept cookies. We’ll store a cookie to remember which option you selected. You can always change your mind and change your choice on this page. Next time you visit the site, we will remember your preference and not show the banner again. -To do this, the Check planning and housing data for England service sets the following cookies: +To do this, the Submit and update planning and housing data for England service sets the following cookies: diff --git a/src/views/privacy-notice.html b/src/views/privacy-notice.html index 1edfd445..a96aa7d6 100644 --- a/src/views/privacy-notice.html +++ b/src/views/privacy-notice.html @@ -1,15 +1,15 @@ {% extends "layouts/main.html" %} -{% set pageName = 'Accessibility statement for check planning and housing data for England' %} +{% set pageName = 'Accessibility statement for Submit and update planning and housing data for England' %} {% set markdownContent %} -# Check planning and housing data for England privacy notice +# Submit and update planning and housing data for England privacy notice ## Who we are -Check planning and housing data for England ([submit.planning.data.gov.uk](https://submit.planning.data.gov.uk)) is provided by the Ministry of Housing, Communities and Local Government (MHCLG). +Submit and update planning and housing data for England ([submit.planning.data.gov.uk](https://submit.planning.data.gov.uk)) is provided by the Ministry of Housing, Communities and Local Government (MHCLG). MHCLG is the data controller for the service. From 1b11c3ebecbd458e7ee426d9248c67f5ff0b34df Mon Sep 17 00:00:00 2001 From: Dilwoar Hussain Date: Tue, 8 Oct 2024 16:26:28 +0100 Subject: [PATCH 4/5] Fix bug with issue count not showing on overview page During the migration of middleware, we somehow managed to cause this feature to be lost. https://github.com/digital-land/submit/issues/500 --- src/middleware/datasetOverview.middleware.js | 3 ++- src/routes/schemas.js | 1 + .../unit/middleware/datasetOverview.middleware.test.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/middleware/datasetOverview.middleware.js b/src/middleware/datasetOverview.middleware.js index df484c9e..816de9d0 100644 --- a/src/middleware/datasetOverview.middleware.js +++ b/src/middleware/datasetOverview.middleware.js @@ -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(';') ?? [] @@ -89,6 +89,7 @@ export const prepareDatasetOverviewTemplateParams = (req, res, next) => { req.templateParams = { organisation: orgInfo, dataset, + issueCount: issues.length ?? 0, stats: { numberOfFieldsSupplied: numberOfFieldsSupplied ?? 0, numberOfFieldsMatched: numberOfFieldsMatched ?? 0, diff --git a/src/routes/schemas.js b/src/routes/schemas.js index ef2e15e8..7c9ed66b 100644 --- a/src/routes/schemas.js +++ b/src/routes/schemas.js @@ -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(), diff --git a/test/unit/middleware/datasetOverview.middleware.test.js b/test/unit/middleware/datasetOverview.middleware.test.js index 2380faa0..3060d6df 100644 --- a/test/unit/middleware/datasetOverview.middleware.test.js +++ b/test/unit/middleware/datasetOverview.middleware.test.js @@ -41,12 +41,22 @@ describe('Dataset Overview Middleware', () => { sources: [ { endpoint_url: 'endpoint1', documentation_url: 'doc-url1', status: '200', endpoint_entry_date: 'LU1', latest_log_entry_date: 'LA1' }, { endpoint_url: 'endpoint2', documentation_url: 'doc-url2', status: '404', exception: 'exception', endpoint_entry_date: 'LU2', latest_log_entry_date: 'LA2' } + ], + issues: [ + { + issue: 'Example issue 1', + issue_type: 'Example issue type 1', + field: 'Example issue field 1', + num_issues: 1, + status: 'Error' + } ] } prepareDatasetOverviewTemplateParams(reqWithResults, res, () => {}) expect(reqWithResults.templateParams).toEqual({ organisation: { name: 'mock-org' }, dataset: reqWithResults.dataset, + issueCount: 1, stats: { numberOfFieldsSupplied: 1, numberOfFieldsMatched: 1, From 3e5de1515ded5a2a8f04caa33b4cba33a01d8f81 Mon Sep 17 00:00:00 2001 From: Dilwoar Hussain Date: Tue, 8 Oct 2024 18:25:47 +0100 Subject: [PATCH 5/5] Fixes an issue where missing org could down the server if it's run in parallel. The `fallbackPolicy` doesn't end the request therefore leaves the thread open. This causes the server to crash the next time the user refreshes as a new header is being attached after the request was already sent. This is initial analysis and needs further investigation. --- src/middleware/datasetOverview.middleware.js | 6 ++---- src/middleware/datasetTaskList.middleware.js | 5 ++--- src/middleware/issueDetails.middleware.js | 6 ++---- src/middleware/overview.middleware.js | 8 +++----- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/middleware/datasetOverview.middleware.js b/src/middleware/datasetOverview.middleware.js index 816de9d0..33f74668 100644 --- a/src/middleware/datasetOverview.middleware.js +++ b/src/middleware/datasetOverview.middleware.js @@ -111,10 +111,8 @@ const getDatasetOverview = renderTemplate( ) export default [ - parallel([ - fetchOrgInfo, - fetchDatasetInfo - ]), + fetchOrgInfo, + fetchDatasetInfo, parallel([ fetchColumnSummary, fetchResourceStatus, diff --git a/src/middleware/datasetTaskList.middleware.js b/src/middleware/datasetTaskList.middleware.js index 07ce42c3..8a5d9f23 100644 --- a/src/middleware/datasetTaskList.middleware.js +++ b/src/middleware/datasetTaskList.middleware.js @@ -113,9 +113,8 @@ const getDatasetTaskListError = renderTemplate({ export default [ fetchResourceStatus, - parallel([ - fetchOrgInfoWithStatGeo, - fetchDatasetInfo]), + fetchOrgInfoWithStatGeo, + fetchDatasetInfo, fetchIf(isResourceAccessible, fetchLatestResource), parallel([ fetchIf(isResourceAccessible, fetchLpaDatasetIssues), diff --git a/src/middleware/issueDetails.middleware.js b/src/middleware/issueDetails.middleware.js index e84e402e..ce5befd3 100644 --- a/src/middleware/issueDetails.middleware.js +++ b/src/middleware/issueDetails.middleware.js @@ -286,10 +286,8 @@ export const getIssueDetails = renderTemplate({ export default [ validateIssueDetailsQueryParams, - parallel([ - fetchOrgInfo, - fetchDatasetInfo - ]), + fetchOrgInfo, + fetchDatasetInfo, fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams), fetchIssues, reformatIssuesToBeByEntryNumber, diff --git a/src/middleware/overview.middleware.js b/src/middleware/overview.middleware.js index 52df17d3..10bb11d2 100644 --- a/src/middleware/overview.middleware.js +++ b/src/middleware/overview.middleware.js @@ -1,6 +1,6 @@ import performanceDbApi, { lpaOverviewQuery } from '../services/performanceDbApi.js' import { fetchOrgInfo, logPageError } from './common.middleware.js' -import { fetchMany, FetchOptions, parallel, renderTemplate } from './middleware.builders.js' +import { fetchMany, FetchOptions, renderTemplate } from './middleware.builders.js' import { dataSubjects } from '../utils/utils.js' import config from '../../config/index.js' import _ from 'lodash' @@ -154,10 +154,8 @@ export const getOverview = renderTemplate({ }) export default [ - parallel([ - fetchOrgInfo, - fetchLatestResources] - ), + fetchOrgInfo, + fetchLatestResources, fetchEntityCounts, fetchLpaOverview, prepareOverviewTemplateParams,