Skip to content

Commit

Permalink
rename status/exception -> latest_status/exception
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCoelhoSL committed Oct 9, 2024
1 parent 12c62de commit 97ca162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/middleware/datasetOverview.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const pullOutDatasetSpecification = (req, res, next) => {

const fetchSources = fetchMany({
query: ({ params }) => `
select rhe.endpoint, rhe.endpoint_url, rhe.status, rhe.exception, rhe.resource, rhe.latest_log_entry_date, rhe.endpoint_entry_date, rhe.endpoint_end_date, rhe.resource_start_date, rhe.resource_end_date, s.documentation_url
select rhe.endpoint, rhe.endpoint_url, rhe.latest_status as status, rhe.latest_exception as status, rhe.resource, rhe.latest_log_entry_date, rhe.endpoint_entry_date, rhe.endpoint_end_date, rhe.resource_start_date, rhe.resource_end_date, s.documentation_url
from reporting_historic_endpoints rhe
LEFT JOIN source s ON rhe.endpoint = s.endpoint
where REPLACE(rhe.organisation, '-eng', '') = '${params.lpa}' and rhe.pipeline = '${params.dataset}'
Expand Down
14 changes: 7 additions & 7 deletions src/services/performanceDbApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,20 @@ SELECT
rle.pipeline as dataset,
rle.endpoint,
rle.resource,
rle.exception,
rle.status as http_status,
rle.latest_exception as exception,
rle.latest_status as http_status,
coalesce(ec.entity_count, 0) as entity_count,
i.count_issues as issue_count,
i.responsibility,
i.fields,
case
when (rle.status is null) then 'Not submitted'
when (rle.status != '200') then 'Error'
when (rle.latest_status is null) then 'Not submitted'
when (rle.latest_status != '200') then 'Error'
when (i.severity = 'error') then 'Needs fixing'
else 'Live'
end as status,
case
when ((cast(rle.status as integer) > 200)) then format('There was a %s error accessing the data URL', rle.status)
when ((cast(rle.latest_status as integer) > 200)) then format('There was a %s error accessing the data URL', rle.latest_status)
else null
end as error,
case
Expand Down Expand Up @@ -176,7 +176,7 @@ export default {

resourceStatusQuery (lpa, datasetId) {
return /* sql */ `
select resource, endpoint_url, status, latest_log_entry_date, days_since_200
select resource, endpoint_url, latest_status as status, latest_log_entry_date, days_since_200
from reporting_latest_endpoints
WHERE REPLACE(organisation, '-eng', '') = '${lpa}'
AND pipeline = '${datasetId}'`
Expand Down Expand Up @@ -255,7 +255,7 @@ export default {

latestResourceQuery: (lpa, dataset) => {
return /* sql */ `
SELECT rle.resource, rle.status, rle.endpoint, rle.endpoint_url, rle.status, rle.days_since_200, rle.exception
SELECT rle.resource, rle.latest_status as status, rle.endpoint, rle.endpoint_url, rle.days_since_200, rle.latest_exception as exception
FROM reporting_latest_endpoints rle
LEFT JOIN resource_organisation ro ON rle.resource = ro.resource
LEFT JOIN organisation o ON REPLACE(ro.organisation, '-eng', '') = o.organisation
Expand Down

0 comments on commit 97ca162

Please sign in to comment.