This commit is contained in:
Jake Kasper
2025-08-23 12:56:13 -04:00
parent 58dc2c83b1
commit 65885dfc87
2 changed files with 9 additions and 22 deletions

View File

@@ -197,8 +197,8 @@ router.get('/', async (req, res, next) => {
et.name as type_name, ec.name as category_name, et.name as type_name, ec.name as category_name,
ue.created_at, ue.updated_at ue.created_at, ue.updated_at
FROM user_equipment ue FROM user_equipment ue
JOIN equipment_types et ON ue.equipment_type_id = et.id LEFT JOIN equipment_types et ON ue.equipment_type_id = et.id
JOIN equipment_categories ec ON et.category_id = ec.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) 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`, ORDER BY ue.manufacturer, ue.custom_name`,
[req.user.id] [req.user.id]

View File

@@ -365,8 +365,13 @@ const PropertyMap = ({
return null; return null;
} }
// Your coordinates are already in [lng, lat] format, so we need to swap them for Leaflet // Check the actual coordinate format in your logs
const coordinates = polygonData.coordinates[0].map(([lng, lat]) => [lat, lng]); 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 isInternallySelected = selectedSection?.id === section.id;
const isExternallySelected = selectedSections.includes(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 && (
<Polygon
positions={[
[property.latitude + 0.001, property.longitude + 0.001],
[property.latitude + 0.001, property.longitude - 0.001],
[property.latitude - 0.001, property.longitude - 0.001],
[property.latitude - 0.001, property.longitude + 0.001]
]}
pathOptions={{
fillColor: 'red',
fillOpacity: 0.8,
color: 'red',
weight: 3,
opacity: 1,
}}
/>
)}
{/* Current polygon being drawn */} {/* Current polygon being drawn */}
{currentPolygon.length > 0 && ( {currentPolygon.length > 0 && (