diff --git a/src/middleware/dataview.middleware.js b/src/middleware/dataview.middleware.js index 71f424eda..2a520de50 100644 --- a/src/middleware/dataview.middleware.js +++ b/src/middleware/dataview.middleware.js @@ -8,6 +8,7 @@ import { fetchLocalPlanningGroups, fetchProvisionsByOrgsAndDatasets, fetchOrgInfo, + fetchSources, noop, processAuthoritativeMiddlewares, processSpecificationMiddlewares, @@ -92,7 +93,11 @@ const fetchOutOfBoundsExpectations = expectationFetcher({ }) export const prepareTemplateParams = (req, res, next) => { - const { orgInfo, dataset, tableParams, pagination, dataRange, tasks, authority, alternateSources, uniqueDatasetFields, provisions, expectationOutOfBounds } = req + const { orgInfo, dataset, tableParams, pagination, dataRange, tasks, authority, alternateSources, uniqueDatasetFields, provisions, expectationOutOfBounds, sources } = req + + // Match the overview page: 'some' authority uses alternative/pre-populated + // sources, not the LPA's own endpoints, so it reports no endpoints. + const endpointCount = authority === 'some' ? 0 : (sources?.length ?? 0) const outOfBoundsCount = (expectationOutOfBounds?.length ?? 0) > 0 ? 1 : 0 const taskCount = authority !== 'some' ? (tasks?.count ?? 0) + outOfBoundsCount : 1 @@ -112,6 +117,7 @@ export const prepareTemplateParams = (req, res, next) => { authority, dataset, taskCount, + endpointCount, tableParams, pagination, dataRange, @@ -138,6 +144,7 @@ export default [ fetchDatasetInfo, fetchResources, + fetchSources, fetchTasksFromPlatformApi, isFeatureEnabled('expectationOutOfBoundsTask') ? fetchOutOfBoundsExpectations : noop, diff --git a/src/routes/schemas.js b/src/routes/schemas.js index e263badcf..2eb625150 100644 --- a/src/routes/schemas.js +++ b/src/routes/schemas.js @@ -213,6 +213,7 @@ export const OrgDataView = v.strictObject({ organisation: OrgField, dataset: DatasetNameField, taskCount: v.integer(), + endpointCount: v.integer(), authority: v.string(), tableParams, pagination: PaginationParams, diff --git a/src/views/organisations/dataset-overview.html b/src/views/organisations/dataset-overview.html index 28f5335d0..4caf081cc 100644 --- a/src/views/organisations/dataset-overview.html +++ b/src/views/organisations/dataset-overview.html @@ -213,7 +213,7 @@

Dataset details

{% if authority !== 'some' %}

Active endpoints

-

You have {{ endpointCount }} endpoint{% if endpointCount != 1 %}s{% endif %} we are currently checking for data.

+

You have {{ endpointCount }} endpoint{% if endpointCount != 1 %}s{% endif %} we are currently checking for data.{% if endpointCount > 1 %} The information within dataset details includes data from all {{ endpointCount }} endpoints.{% endif %}

{% for endpointSummaryCard in endpointSummaryCards %} {{ govukSummaryList(endpointSummaryCard) }} {% endfor %} diff --git a/src/views/organisations/dataview.html b/src/views/organisations/dataview.html index a1d82125b..5ef5efb36 100644 --- a/src/views/organisations/dataview.html +++ b/src/views/organisations/dataview.html @@ -59,6 +59,18 @@ +
+
+
+

About this data

+

We accept data in different formats and standardise it, so that we can combine it with data from other sources. This means the data we show might be in a different format to the data you provided. For example, we standardise all dates as YYYY-MM-DD.

+ {% if endpointCount > 1 %} +

The information within this data is from all {{ endpointCount }} of your endpoints.

+ {% endif %} +
+
+
+
{{ table(tableParams) }} diff --git a/test/acceptance/request_check.test.js b/test/acceptance/request_check.test.js index 2896c2c7e..103e364d8 100644 --- a/test/acceptance/request_check.test.js +++ b/test/acceptance/request_check.test.js @@ -21,8 +21,7 @@ const navigateToCheck = async (page) => { const okFile = 'https://raw.githubusercontent.com/digital-land/PublishExamples/refs/heads/main/Article4Direction/Files/Article4DirectionArea/article4directionareas-ok.csv' const errorFile = 'https://raw.githubusercontent.com/digital-land/PublishExamples/refs/heads/main/Article4Direction/Files/Article4DirectionArea/article4directionareas-errors.csv' -// TODO: this file should cause a SSL Certificate error when served to the async. It currently does but is temporary (A link that causes a Server Timeout Error or SSL Error is required) -const serverErrorFile = 'https://www.tendringdc.gov.uk/sites/default/files/documents/planning/CAD%20csv.csv' +const serverErrorFile = 'http://expired.badssl.com' const htmlFile = 'https://en.wikipedia.org/wiki/John_Doe' let lastTimestamp = 0 diff --git a/test/unit/middleware/dataview.middleware.test.js b/test/unit/middleware/dataview.middleware.test.js index 1bd515852..77ad1b948 100644 --- a/test/unit/middleware/dataview.middleware.test.js +++ b/test/unit/middleware/dataview.middleware.test.js @@ -206,6 +206,7 @@ describe('dataview.middleware.test.js', () => { dataset: { name: 'Mock Dataset', dataset: 'mock-dataset' }, authority: 'mock-authority', taskCount: 0, + endpointCount: 0, tableParams: { columns: ['foo'], fields: ['foo'] }, pagination: {}, dataRange: {