Skip to content

Commit

Permalink
feat: add granular Listed Building grades to GIS responses (#2746)
Browse files Browse the repository at this point in the history
Co-authored-by: Dafydd Llŷr Pearson <[email protected]>
  • Loading branch information
jessicamcinchak and DafyddLlyr authored Feb 8, 2024
1 parent 539b774 commit 31718c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions api.planx.uk/modules/gis/service/digitalLand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function go(
formattedResult[broads] = { fn: broads, value: false };
}

// FLOODING
// --- FLOODING ---
if (formattedResult["flood"] && formattedResult["flood"].value) {
["flood.zone.1", "flood.zone.2", "flood.zone.3"].forEach(
(zone) =>
Expand All @@ -188,7 +188,20 @@ async function go(
}

// --- LISTED BUILDINGS ---
// TODO add granular variables to reflect grade (eg `listed.grade1`), not reflected in content yet though
if (formattedResult["listed"] && formattedResult["listed"].value) {
["listed.grade.I", "listed.grade.II", "listed.grade.II*"].forEach(
(grade) =>
(formattedResult[grade] = {
fn: grade,
value: Boolean(
formattedResult["listed"].data?.filter(
(entity) =>
entity["listed-building-grade"] === grade.split(".").pop(),
).length,
),
}),
);
}

// --- ARTICLE 4S ---
// only attempt to set granular a4s if we have metadata for this local authority; proceed with non-granular a4 queries under "opensystemslab" team etc
Expand Down

0 comments on commit 31718c6

Please sign in to comment.