From 80645dac1c1a4dfbdacac9f40e5781a8b1ef0003 Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Fri, 29 Aug 2025 14:36:24 -0400 Subject: [PATCH] asdfafd --- backend/src/routes/applications.js | 14 ---------- .../Applications/ApplicationViewModal.js | 26 +++---------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/backend/src/routes/applications.js b/backend/src/routes/applications.js index 507811d..88f6ff9 100644 --- a/backend/src/routes/applications.js +++ b/backend/src/routes/applications.js @@ -931,9 +931,7 @@ router.put('/plans/:id/status', validateParams(idParamSchema), async (req, res, // @access Private router.get('/logs', async (req, res, next) => { try { - console.log('=== FIRST LOGS ENDPOINT CALLED ==='); const { property_id, start_date, end_date, limit = 50, planId } = req.query; - console.log('Query params:', { property_id, start_date, end_date, limit, planId }); let whereConditions = ['al.user_id = $1']; let queryParams = [req.user.id]; @@ -986,18 +984,6 @@ router.get('/logs', async (req, res, next) => { queryParams ); - console.log(`Found ${result.rows.length} logs`); - if (result.rows.length > 0) { - console.log('First log gps_track:', result.rows[0].gps_track); - console.log('First log raw data sample:', { - id: result.rows[0].id, - plan_id: result.rows[0].plan_id, - gps_track: result.rows[0].gps_track, - average_speed: result.rows[0].average_speed, - area_covered: result.rows[0].area_covered, - notes: result.rows[0].notes - }); - } res.json({ success: true, diff --git a/frontend/src/components/Applications/ApplicationViewModal.js b/frontend/src/components/Applications/ApplicationViewModal.js index 61c9924..2aa849b 100644 --- a/frontend/src/components/Applications/ApplicationViewModal.js +++ b/frontend/src/components/Applications/ApplicationViewModal.js @@ -11,22 +11,14 @@ const ApplicationViewModal = ({ application, propertyDetails, onClose }) => { // Calculate coverage percentage based on GPS tracking and equipment specifications const calculateCoverage = (application, log) => { - console.log('calculateCoverage called with:', { application, log }); - console.log('GPS track points:', log?.gpsTrack?.points?.length || 0); - console.log('GPS track structure:', log?.gpsTrack); - if (!log?.gpsTrack?.points || log.gpsTrack.points.length < 2) { - console.log('No GPS points or insufficient points for coverage calculation'); return 0; // No movement = no coverage } const totalDistance = log.gpsTrack.totalDistance || 0; const plannedArea = application.totalSectionArea || 0; - console.log('Total distance:', totalDistance, 'Planned area:', plannedArea); - if (totalDistance === 0 || plannedArea === 0) { - console.log('Zero distance or area, returning 0 coverage'); return 0; } @@ -70,22 +62,10 @@ const ApplicationViewModal = ({ application, propertyDetails, onClose }) => { // Try to fetch application logs to get GPS tracking data try { - console.log('Fetching logs for planId:', application.id); - // Add cache-busting parameter to force fresh request - const logsResponse = await applicationsAPI.getLogs({ - planId: application.id, - _t: Date.now() - }); - console.log('Logs response:', logsResponse); + const logsResponse = await applicationsAPI.getLogs({ planId: application.id }); const logs = logsResponse.data.data.logs; - console.log('Parsed logs:', logs); if (logs && logs.length > 0) { - console.log('Setting application log to:', logs[0]); - console.log('Log GPS track property:', logs[0].gpsTrack); - console.log('Full log object keys:', Object.keys(logs[0])); setApplicationLog(logs[0]); // Get the most recent log - } else { - console.log('No logs found in response'); } } catch (error) { console.log('No application logs found:', error); @@ -234,7 +214,9 @@ const ApplicationViewModal = ({ application, propertyDetails, onClose }) => {
Average Speed
-
{applicationLog.averageSpeed?.toFixed(1)} mph
+
+ {(applicationLog.gpsTrack?.averageSpeed || applicationLog.averageSpeed || 0).toFixed(1)} mph +
GPS Points