Skip to content

Commit

Permalink
fix: account for un-checked Article 4 values in GIS API (#4066)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak authored Dec 11, 2024
1 parent 1877c27 commit 79b90d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api.planx.uk/modules/gis/service/digitalLand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async function go(
const a4s = planningConstraints["article4"]["records"] || undefined;

// loop through any intersecting a4 data entities and set granular planx values based on this local authority's schema
if (a4s && formattedResult["article4"].value) {
if (a4s && formattedResult["article4"]?.value) {
formattedResult["article4"]?.data?.forEach((entity: any) => {
Object.keys(a4s)?.forEach((key) => {
if (
Expand Down Expand Up @@ -280,8 +280,8 @@ async function go(

// if caz is true, but parent a4 is false, sync a4 for accurate granularity
if (
formattedResult[localCaz].value &&
!formattedResult["article4"].value
formattedResult[localCaz]?.value &&
!formattedResult["article4"]?.value
) {
formattedResult["article4"] = {
fn: "article4",
Expand Down
5 changes: 5 additions & 0 deletions api.planx.uk/modules/gis/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const localAuthorities = { digitalLand };
* type: string
* required: true
* description: Well-Known Text (WKT) formatted polygon or point
* - in: query
* name: vals
* type: string
* required: false
* description: Comma-separated list of planning constraint values (formatted using `fn` property names) that should be returned
*/
export async function locationSearch(req, res, next) {
// 'geom' param signals this localAuthority has data available via Planning Data
Expand Down

0 comments on commit 79b90d9

Please sign in to comment.