From 2dd62fb938bf33abdaddc81bd12b409b6eab58dc Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Fri, 22 Aug 2025 16:04:34 -0400 Subject: [PATCH] nozzle debug --- backend/src/routes/nozzles.js | 26 +++---------------- frontend/src/components/Maps/PropertyMap.js | 11 +------- .../src/pages/Applications/Applications.js | 2 +- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/backend/src/routes/nozzles.js b/backend/src/routes/nozzles.js index 6aad5a0..060834d 100644 --- a/backend/src/routes/nozzles.js +++ b/backend/src/routes/nozzles.js @@ -166,29 +166,7 @@ router.get('/flow-rate/:nozzleTypeId/:pressurePsi', validateParams(idParamSchema // @access Private router.get('/', async (req, res, next) => { try { - // Debug: Check what equipment categories exist - const categoriesResult = await pool.query( - `SELECT DISTINCT ec.name as category_name, COUNT(*) as count - 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 - WHERE ue.user_id = $1 - GROUP BY ec.name`, - [req.user.id] - ); - console.log('User equipment categories:', categoriesResult.rows); - - // Debug: Check all equipment with nozzle-related fields - const nozzleFieldsResult = await pool.query( - `SELECT ue.id, ue.custom_name, ec.name as category_name, et.name as type_name, - ue.orifice_size, ue.spray_angle, ue.flow_rate_gpm - 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 - WHERE ue.user_id = $1 AND (ue.orifice_size IS NOT NULL OR ec.name ILIKE '%nozzle%')`, - [req.user.id] - ); - console.log('Equipment with nozzle fields:', nozzleFieldsResult.rows); + console.log('Nozzles API called for user:', req.user.id); const result = await pool.query( `SELECT ue.id, ue.custom_name, ue.manufacturer, ue.model, @@ -205,6 +183,8 @@ router.get('/', async (req, res, next) => { [req.user.id] ); + console.log('Nozzles query result:', result.rows); + res.json({ success: true, data: { diff --git a/frontend/src/components/Maps/PropertyMap.js b/frontend/src/components/Maps/PropertyMap.js index 69d8088..b222db5 100644 --- a/frontend/src/components/Maps/PropertyMap.js +++ b/frontend/src/components/Maps/PropertyMap.js @@ -327,12 +327,7 @@ const PropertyMap = ({ className="h-full w-full rounded-lg" ref={mapRef} > - - - {/* Satellite imagery option */} + {/* Use satellite imagery for application planning */} { - console.log('Section:', section); - // Handle both string and object polygon data let polygonData = section.polygonData; if (typeof polygonData === 'string') { @@ -369,13 +362,11 @@ const PropertyMap = ({ } if (!polygonData?.coordinates?.[0]) { - console.log('No coordinates found for section:', section.id); 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]); - console.log('Mapped coordinates:', coordinates); const isInternallySelected = selectedSection?.id === section.id; const isExternallySelected = selectedSections.includes(section.id); diff --git a/frontend/src/pages/Applications/Applications.js b/frontend/src/pages/Applications/Applications.js index 6219245..4360aea 100644 --- a/frontend/src/pages/Applications/Applications.js +++ b/frontend/src/pages/Applications/Applications.js @@ -513,7 +513,7 @@ const ApplicationPlanModal = ({ onClose, onSubmit }) => { {nozzles.length === 0 && (

- No nozzles found. Add nozzles in Equipment management first. + No nozzles found. Go to Equipment → Add Equipment → Select "Nozzle" category to add nozzles first.

)}