mowing and properties

This commit is contained in:
Jake Kasper
2025-09-03 10:28:24 -04:00
parent 1c6ab9e569
commit fe6f7f3858
4 changed files with 219 additions and 15 deletions

View File

@@ -373,11 +373,10 @@ const History = () => {
const meters = (log.total_distance_meters || log.gpsTrack?.totalDistance || log.gps_track?.totalDistance || 0) || 0;
const totalDistanceFeet = meters * 3.28084;
const plannedArea = Number(log.total_area || 0);
if (totalDistanceFeet === 0 || plannedArea === 0) return 0;
let equipmentWidth = 6; // default mower deck width in ft
const name = (log.equipment_name || '').toLowerCase();
if (name.includes('30"') || name.includes('30 in')) equipmentWidth = 2.5;
const theoreticalCoverageArea = totalDistanceFeet * equipmentWidth;
const widthInches = parseFloat(log.cutting_width_inches || 0);
const widthFeet = isNaN(widthInches) ? 0 : (widthInches / 12);
if (totalDistanceFeet === 0 || plannedArea === 0 || widthFeet === 0) return 0;
const theoreticalCoverageArea = totalDistanceFeet * widthFeet;
return Math.min(100, Math.round((theoreticalCoverageArea / plannedArea) * 100));
};