Skip to content

Commit

Permalink
only include boundary property when defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Oct 20, 2023
1 parent d84fca2 commit 4b23b02
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/export/digitalPlanning/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
ApplicationType,
DigitalPlanningApplication as Payload,
LondonProperty,
PlanningConstraint,
UKProperty,
} from "./schema/types";

Expand Down Expand Up @@ -322,8 +321,6 @@ export class DigitalPlanning {
private getProperty(): Payload["data"]["property"] {
const baseProperty = {
address: this.getPropertyAddress(),
boundary: this.getBoundary(),
constraints: this.getPlanningConstraints(),
localAuthorityDistrict:
this.passport.data?.["property.localAuthorityDistrict"],
region: this.passport.data?.["property.region"][0],
Expand All @@ -334,6 +331,13 @@ export class DigitalPlanning {
this.passport.data?.["property.type"][0],
),
},
// Only include the 'boundary' & `constraints` keys in cases where we have data
...(this.passport.data?.["property.boundary.site"] && {
boundary: this.getBoundary(),
}),
...(this.passport.data?._constraint && {
constraints: this.getPlanningConstraints(),
}),
};

if (this.passport.data?._address?.["property.region"]?.[0] === "London") {
Expand Down Expand Up @@ -480,11 +484,12 @@ export class DigitalPlanning {
flow: this.flow as LooseFlowGraph,
});
const { flag } = Object.values(result)[0];
const title = [flag.category, flag.text].join(" / ");

return [
{
value: [flag.category, flag.text].join(" / "),
description: flag.description,
value: title,
description: this.findDescriptionFromValue("ResultFlag", title), // flag.description may be custom text
},
] as Payload["result"];
}
Expand All @@ -502,11 +507,13 @@ export class DigitalPlanning {
),
description:
this.passport.data?.["proposal.description"] || "Not provided",
boundary: this.getBoundary(),
date: {
start: this.passport.data?.["proposal.start.date"],
completion: this.passport.data?.["proposal.completion.date"], // this.passport.data?.["proposal.finish.date"],
},
...(this.passport.data?.["property.boundary.site"] && {
boundary: this.getBoundary(),
}),
};

if (this.passport.data?.["proposal.extend.area"]) {
Expand Down

0 comments on commit 4b23b02

Please sign in to comment.