Skip to content

Commit

Permalink
add overwritten token to entry table
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Oct 30, 2024
1 parent 4ae2620 commit 1e6d914
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/middleware/issueDetails.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ const processEntryRow = (issueType, issuesByEntryNumber, row) => {
classes += 'dl-summary-card-list__row--error'
}
valueHtml += row.value
if (row.has_later_fact) {
valueHtml += '<br><span style="color: grey">(overwritten by more recent resource)</span>'
}

return getIssueField(row.field, valueHtml, classes)
}
Expand All @@ -173,13 +176,13 @@ const processEntryRow = (issueType, issuesByEntryNumber, row) => {
*/
export function prepareIssueDetailsTemplateParams (req, res, next) {
const { entryData, pageNumber, issueEntitiesCount, issuesByEntryNumber, entryNumber, entityCount: entityCountRow } = req
const { lpa, dataset: datasetId, issue_type: issueType, issue_field: issueField } = req.params
const { lpa, dataset: datasetId, issue_type: issueType, issue_field: issueField, resource } = req.params
const { entity_count: entityCount } = entityCountRow ?? { entity_count: 0 }

let errorHeading
let issueItems

const BaseSubpath = `/organisations/${lpa}/${datasetId}/${issueType}/${issueField}/`
const BaseSubpath = `/organisations/${lpa}/${datasetId}/${resource}/${issueType}/${issueField}/`

if (Object.keys(issuesByEntryNumber).length < entityCount) {
errorHeading = performanceDbApi.getTaskMessage({ issue_type: issueType, num_issues: issueEntitiesCount, entityCount, field: issueField }, true)
Expand Down
12 changes: 11 additions & 1 deletion src/services/performanceDbApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,17 @@ export default {
ft.field,
ft.entry_date,
ft.start_date,
ft.value
ft.value,
EXISTS (
SELECT
1
FROM
fact ft2
WHERE
ft2.entity = ft.entity
AND ft2.field = ft.field
AND ft2.entry_date > ft.entry_date
) AS has_later_fact
from
fact_resource fr
left join fact ft on fr.fact = ft.fact
Expand Down

0 comments on commit 1e6d914

Please sign in to comment.