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
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: {

View File

@@ -327,12 +327,7 @@ const PropertyMap = ({
className="h-full w-full rounded-lg"
ref={mapRef}
>
<TileLayer
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 */}
{/* Use satellite imagery for application planning */}
<TileLayer
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}"
@@ -355,8 +350,6 @@ const PropertyMap = ({
{/* Existing sections */}
{sections.map((section) => {
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);

View File

@@ -513,7 +513,7 @@ const ApplicationPlanModal = ({ onClose, onSubmit }) => {
</select>
{nozzles.length === 0 && (
<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>
)}
</div>