Skip to content

Commit

Permalink
Merge pull request #528 from digital-land/add-endpoint-summary-join
Browse files Browse the repository at this point in the history
Adjusts column summary query to use endpoint_dataset_summary table end date
  • Loading branch information
GeorgeGoodall-GovUk authored Oct 9, 2024
2 parents d619671 + 996c7d4 commit 12c62de
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ import { fetchResourceStatus } from './datasetTaskList.middleware.js'
import performanceDbApi from '../services/performanceDbApi.js'

const fetchColumnSummary = fetchMany({
query: ({ params }) => `select * from endpoint_dataset_resource_summary
where resource != ''
and endpoint_end_date = ''
and pipeline = '${params.dataset}'
AND organisation = '${params.lpa}'
query: ({ params }) => `
SELECT
edrs.*
FROM
endpoint_dataset_resource_summary edrs
INNER JOIN (
SELECT
endpoint,
dataset,
organisation,
end_date as endpoint_end_date
FROM
endpoint_dataset_summary
WHERE
end_date = ''
) as t1 on t1.endpoint = edrs.endpoint
AND replace(t1.organisation, '-eng', '') = edrs.organisation
AND t1.dataset = edrs.dataset
WHERE
edrs.resource != ''
AND edrs.pipeline = '${params.dataset}'
AND edrs.organisation = '${params.lpa}'
limit 1000`,
result: 'columnSummary',
dataset: FetchOptions.performanceDb
Expand Down

0 comments on commit 12c62de

Please sign in to comment.