Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/middleware/dataview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
fetchLocalPlanningGroups,
fetchProvisionsByOrgsAndDatasets,
fetchOrgInfo,
fetchSources,
noop,
processAuthoritativeMiddlewares,
processSpecificationMiddlewares,
Expand Down Expand Up @@ -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
Expand All @@ -112,6 +117,7 @@ export const prepareTemplateParams = (req, res, next) => {
authority,
dataset,
taskCount,
endpointCount,
tableParams,
pagination,
dataRange,
Expand All @@ -138,6 +144,7 @@ export default [
fetchDatasetInfo,

fetchResources,
fetchSources,
fetchTasksFromPlatformApi,
isFeatureEnabled('expectationOutOfBoundsTask') ? fetchOutOfBoundsExpectations : noop,

Expand Down
1 change: 1 addition & 0 deletions src/routes/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/views/organisations/dataset-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ <h2 class="govuk-heading-m">Dataset details</h2>
{% if authority !== 'some' %}
<section>
<h2 class="govuk-heading-m">Active endpoints</h2>
<p class="govuk-body">You have {{ endpointCount }} endpoint{% if endpointCount != 1 %}s{% endif %} we are currently checking for data.</p>
<p class="govuk-body">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 %}</p>
{% for endpointSummaryCard in endpointSummaryCards %}
{{ govukSummaryList(endpointSummaryCard) }}
{% endfor %}
Expand Down
12 changes: 12 additions & 0 deletions src/views/organisations/dataview.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<section>
<h2 class="govuk-heading-m">About this data</h2>
<p class="govuk-body">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.</p>
{% if endpointCount > 1 %}
<p class="govuk-body">The information within this data is from all {{ endpointCount }} of your endpoints.</p>
{% endif %}
</section>
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
{{ table(tableParams) }}
Expand Down
3 changes: 1 addition & 2 deletions test/acceptance/request_check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/unit/middleware/dataview.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Loading