Skip to content

Commit

Permalink
Merge branch 'main' into add-endpoint-summary-join
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCoelhoSL authored Oct 9, 2024
2 parents 8475f10 + d619671 commit 996c7d4
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
9 changes: 4 additions & 5 deletions src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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 @@ -106,6 +106,7 @@ export const prepareDatasetOverviewTemplateParams = (req, res, next) => {
req.templateParams = {
organisation: orgInfo,
dataset,
issueCount: issues.length ?? 0,
stats: {
numberOfFieldsSupplied: numberOfFieldsSupplied ?? 0,
numberOfFieldsMatched: numberOfFieldsMatched ?? 0,
Expand All @@ -127,10 +128,8 @@ const getDatasetOverview = renderTemplate(
)

export default [
parallel([
fetchOrgInfo,
fetchDatasetInfo
]),
fetchOrgInfo,
fetchDatasetInfo,
parallel([
fetchColumnSummary,
fetchResourceStatus,
Expand Down
5 changes: 2 additions & 3 deletions src/middleware/datasetTaskList.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ const getDatasetTaskListError = renderTemplate({

export default [
fetchResourceStatus,
parallel([
fetchOrgInfoWithStatGeo,
fetchDatasetInfo]),
fetchOrgInfoWithStatGeo,
fetchDatasetInfo,
fetchIf(isResourceAccessible, fetchLatestResource),
parallel([
fetchIf(isResourceAccessible, fetchLpaDatasetIssues),
Expand Down
6 changes: 2 additions & 4 deletions src/middleware/issueDetails.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,8 @@ export const getIssueDetails = renderTemplate({

export default [
validateIssueDetailsQueryParams,
parallel([
fetchOrgInfo,
fetchDatasetInfo
]),
fetchOrgInfo,
fetchDatasetInfo,
fetchIf(isResourceIdInParams, fetchLatestResource, takeResourceIdFromParams),
fetchIssues,
reformatIssuesToBeByEntryNumber,
Expand Down
8 changes: 3 additions & 5 deletions src/middleware/overview.middleware.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -154,10 +154,8 @@ export const getOverview = renderTemplate({
})

export default [
parallel([
fetchOrgInfo,
fetchLatestResources]
),
fetchOrgInfo,
fetchLatestResources,
fetchEntityCounts,
fetchLpaOverview,
prepareOverviewTemplateParams,
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
6 changes: 3 additions & 3 deletions src/views/accessibility.html
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
12 changes: 6 additions & 6 deletions src/views/cookies.html
Original file line number Diff line number Diff line change
@@ -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:



Expand All @@ -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:

<table class="govuk-table">
<thead class="govuk-table__head">
Expand Down
2 changes: 1 addition & 1 deletion src/views/errorPages/400.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1 class="govuk-heading-l">{{pageName}}</h1>

<p>If you pasted the web address, check you copied the entire address.</p>

<p>If the web address is correct or vou selected a link or button send an email
<p>If the web address is correct or you selected a link or button send an email
to <a href="mailto:[email protected]">[email protected]</a>.</p>

</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/errorPages/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1 class="govuk-heading-l">{{pageName}}</h1>

<p>If you pasted the web address, check you copied the entire address.</p>

<p>If the web address is correct or vou selected a link or button send an email
<p>If the web address is correct or you selected a link or button send an email
to <a href="mailto:[email protected]">[email protected]</a>.</p>

</div>
Expand Down
6 changes: 3 additions & 3 deletions src/views/privacy-notice.html
Original file line number Diff line number Diff line change
@@ -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 ([check.planning.data.go.uk](check.planning.data.go.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.

Expand Down
10 changes: 10 additions & 0 deletions test/unit/middleware/datasetOverview.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 996c7d4

Please sign in to comment.