diff --git a/api.planx.uk/admin/session/html.ts b/api.planx.uk/admin/session/html.ts index 493bd58dd5..e6c88eba1a 100644 --- a/api.planx.uk/admin/session/html.ts +++ b/api.planx.uk/admin/session/html.ts @@ -24,8 +24,9 @@ export const getHTMLExport: HTMLExportHandler = async (req, res, next) => { if (!session) throw Error(`Unable to find session ${req.params.sessionId}`); const responses = await $api.export.csvData(req.params.sessionId); - const boundingBox = - session.data.passport.data["property.boundary.site.buffered"]; + const boundingBox = session.data.passport.data[ + "property.boundary.site.buffered" + ] as unknown as GeoJSON.Feature; const html = generateApplicationHTML({ planXExportData: responses as PlanXExportData[], @@ -66,8 +67,9 @@ export const getRedactedHTMLExport: HTMLExportHandler = async ( const redactedResponses = await $api.export.csvDataRedacted( req.params.sessionId, ); - const boundingBox = - session.data.passport.data["property.boundary.site.buffered"]; + const boundingBox = session.data.passport.data[ + "property.boundary.site.buffered" + ] as unknown as GeoJSON.Feature; const html = generateApplicationHTML({ planXExportData: redactedResponses as PlanXExportData[], diff --git a/api.planx.uk/inviteToPay/createPaymentSendEvents.ts b/api.planx.uk/inviteToPay/createPaymentSendEvents.ts index 75f1245ed5..055a884afd 100644 --- a/api.planx.uk/inviteToPay/createPaymentSendEvents.ts +++ b/api.planx.uk/inviteToPay/createPaymentSendEvents.ts @@ -88,9 +88,11 @@ const createPaymentSendEvents = async ( if (destinations.includes(Destination.Uniform)) { // Bucks has 3 instances of Uniform for 4 legacy councils, set teamSlug to pre-merger council name if (teamSlug === "buckinghamshire") { - teamSlug = session.data?.passport?.data?.[ + const localAuthorities: string[] = session.data?.passport?.data?.[ "property.localAuthorityDistrict" - ] + ] as string[]; + + teamSlug = localAuthorities ?.filter((name: string) => name !== "Buckinghamshire")[0] ?.toLowerCase() ?.replace(/\W+/g, "-"); diff --git a/editor.planx.uk/src/@planx/components/Result/Editor.tsx b/editor.planx.uk/src/@planx/components/Result/Editor.tsx index 3949d16386..d41351f3c6 100644 --- a/editor.planx.uk/src/@planx/components/Result/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Editor.tsx @@ -14,7 +14,12 @@ import { TYPES } from "../types"; import { ICONS } from "../ui"; import type { Result } from "./model"; -const flags = groupBy(flatFlags, (f) => f.category); +type FlagWithValue = Flag & { value: NonNullable }; + +const flagsWithValues = flatFlags.filter((flag): flag is FlagWithValue => + Boolean(flag.value), +); +const flags = groupBy(flagsWithValues, (f) => f.category); interface FormData { flagSet: FlagSet; diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts index 629982166e..a2a1795d3b 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/preview.ts @@ -102,7 +102,9 @@ export const previewStore: StateCreator< const possibleFlags = flatFlags.filter( (f) => f.category === DEFAULT_FLAG_CATEGORY, ); - const flagKeys: string[] = possibleFlags.map((f) => f.value); + const flagKeys: string[] = possibleFlags + .map((flag) => flag.value) + .filter((value): value is string => Boolean(value)); const breadcrumbIds = Object.keys(breadcrumbs);