From 65885dfc873febdd449cd4689c8a18ad282c9199 Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Sat, 23 Aug 2025 12:56:13 -0400 Subject: [PATCH] asdkjf --- backend/src/routes/nozzles.js | 4 +-- frontend/src/components/Maps/PropertyMap.js | 27 ++++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/backend/src/routes/nozzles.js b/backend/src/routes/nozzles.js index e4d7efe..4940444 100644 --- a/backend/src/routes/nozzles.js +++ b/backend/src/routes/nozzles.js @@ -197,8 +197,8 @@ router.get('/', async (req, res, next) => { et.name as type_name, ec.name as category_name, ue.created_at, ue.updated_at FROM user_equipment ue - JOIN equipment_types et ON ue.equipment_type_id = et.id - JOIN equipment_categories ec ON et.category_id = ec.id + LEFT JOIN equipment_types et ON ue.equipment_type_id = et.id + LEFT JOIN equipment_categories ec ON COALESCE(et.category_id, ue.category_id) = ec.id WHERE ue.user_id = $1 AND (ec.name = 'Nozzle' OR ec.name ILIKE '%nozzle%' OR ue.orifice_size IS NOT NULL) ORDER BY ue.manufacturer, ue.custom_name`, [req.user.id] diff --git a/frontend/src/components/Maps/PropertyMap.js b/frontend/src/components/Maps/PropertyMap.js index b758515..f304461 100644 --- a/frontend/src/components/Maps/PropertyMap.js +++ b/frontend/src/components/Maps/PropertyMap.js @@ -365,8 +365,13 @@ const PropertyMap = ({ return null; } - // Your coordinates are already in [lng, lat] format, so we need to swap them for Leaflet - const coordinates = polygonData.coordinates[0].map(([lng, lat]) => [lat, lng]); + // Check the actual coordinate format in your logs + console.log('Raw polygon coordinates:', polygonData.coordinates[0]); + const coordinates = polygonData.coordinates[0].map(([first, second]) => { + console.log('Coordinate pair:', [first, second]); + // Based on your console logs, coordinates appear to be [lng, lat], so swap them + return [second, first]; // [lat, lng] for Leaflet + }); const isInternallySelected = selectedSection?.id === section.id; const isExternallySelected = selectedSections.includes(section.id); @@ -390,24 +395,6 @@ const PropertyMap = ({ ); })} - {/* Debug: Add a test polygon to see if polygons work at all */} - {property?.latitude && property?.longitude && ( - - )} {/* Current polygon being drawn */} {currentPolygon.length > 0 && (