fix: rewrite GPS stats to calculate from stored history (#22)

- Replace Traccar summary API dependency with local Haversine distance calculation
- Calculate mileage from GpsLocationHistory table (sum consecutive positions)
- Filter out GPS jitter (<0.01mi), gaps (>10min), and unrealistic speeds (>100mph)
- Calculate trips, driving time, average/top speed from position history
- Add detailed stats logging for debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 16:48:41 +01:00
parent 4dbb899409
commit d93919910b
2 changed files with 179 additions and 46 deletions

View File

@@ -420,7 +420,7 @@ model GpsLocationHistory {
latitude Float
longitude Float
altitude Float?
speed Float? // km/h
speed Float? // mph (converted from knots during sync)
course Float? // Bearing in degrees
accuracy Float? // Meters
battery Float? // Battery percentage (0-100)