nozzle debug

This commit is contained in:
Jake Kasper
2025-08-22 16:04:34 -04:00
parent 92945aa2e1
commit 2dd62fb938
3 changed files with 5 additions and 34 deletions

View File

@@ -166,29 +166,7 @@ router.get('/flow-rate/:nozzleTypeId/:pressurePsi', validateParams(idParamSchema
// @access Private // @access Private
router.get('/', async (req, res, next) => { router.get('/', async (req, res, next) => {
try { try {
// Debug: Check what equipment categories exist console.log('Nozzles API called for user:', req.user.id);
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);
const result = await pool.query( const result = await pool.query(
`SELECT ue.id, ue.custom_name, ue.manufacturer, ue.model, `SELECT ue.id, ue.custom_name, ue.manufacturer, ue.model,
@@ -205,6 +183,8 @@ router.get('/', async (req, res, next) => {
[req.user.id] [req.user.id]
); );
console.log('Nozzles query result:', result.rows);
res.json({ res.json({
success: true, success: true,
data: { data: {

View File

@@ -327,12 +327,7 @@ const PropertyMap = ({
className="h-full w-full rounded-lg" className="h-full w-full rounded-lg"
ref={mapRef} ref={mapRef}
> >
<TileLayer {/* Use satellite imagery for application planning */}
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
{/* Satellite imagery option */}
<TileLayer <TileLayer
attribution='Tiles &copy; Esri &mdash; Source: Esri, Maxar, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community' attribution='Tiles &copy; Esri &mdash; Source: Esri, Maxar, GeoEye, Earthstar Geographics, CNES/Airbus DS, USDA, USGS, AeroGRID, IGN, and the GIS User Community'
url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}" url="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
@@ -355,8 +350,6 @@ const PropertyMap = ({
{/* Existing sections */} {/* Existing sections */}
{sections.map((section) => { {sections.map((section) => {
console.log('Section:', section);
// Handle both string and object polygon data // Handle both string and object polygon data
let polygonData = section.polygonData; let polygonData = section.polygonData;
if (typeof polygonData === 'string') { if (typeof polygonData === 'string') {
@@ -369,13 +362,11 @@ const PropertyMap = ({
} }
if (!polygonData?.coordinates?.[0]) { if (!polygonData?.coordinates?.[0]) {
console.log('No coordinates found for section:', section.id);
return null; return null;
} }
// Your coordinates are already in [lng, lat] format, so we need to swap them for Leaflet // 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]); const coordinates = polygonData.coordinates[0].map(([lng, lat]) => [lat, lng]);
console.log('Mapped coordinates:', coordinates);
const isInternallySelected = selectedSection?.id === section.id; const isInternallySelected = selectedSection?.id === section.id;
const isExternallySelected = selectedSections.includes(section.id); const isExternallySelected = selectedSections.includes(section.id);

View File

@@ -513,7 +513,7 @@ const ApplicationPlanModal = ({ onClose, onSubmit }) => {
</select> </select>
{nozzles.length === 0 && ( {nozzles.length === 0 && (
<p className="text-sm text-orange-600 mt-1"> <p className="text-sm text-orange-600 mt-1">
No nozzles found. Add nozzles in Equipment management first. No nozzles found. Go to Equipment Add Equipment Select "Nozzle" category to add nozzles first.
</p> </p>
)} )}
</div> </div>