From f603f97866c94b11b757cb1a77dccba9e40d0957 Mon Sep 17 00:00:00 2001 From: Alexander Goryushkin Date: Fri, 22 Mar 2024 19:14:00 -0300 Subject: [PATCH] add segments filter. Remove Buildings and setback types fix errors --- src/streetplan/streetplan-utils.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/streetplan/streetplan-utils.js b/src/streetplan/streetplan-utils.js index 5b48a1342..c384aa565 100644 --- a/src/streetplan/streetplan-utils.js +++ b/src/streetplan/streetplan-utils.js @@ -21,7 +21,13 @@ function convertStreetStruct (streetProject) { newStruct.segments = Object.values(streetProject[streetplanName][streetplanAltName].segments); convertStreetValues(newStruct); - convertSegmentData(newStruct.segments); + + // remove buildings and setback for now. To add them in another place + newStruct.segments = convertSegmentData(newStruct.segments) + .filter((segmentData) => { + return !["Buildings", "setback"].includes(segmentData['type']) + }); + console.log("TEST. Converted JSON structure: ", newStruct) return newStruct; @@ -30,5 +36,5 @@ function convertStreetStruct (streetProject) { module.exports.convertStreetStruct = convertStreetStruct; function convertSegmentData (segments) { - segments.forEach(mappingUtils.convertSegment); + return segments.map(mappingUtils.convertSegment); }