Fix undefined haversineDistance function call in map refresh service#162
Conversation
…kAndRefreshMap Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
|
@copilot ✅ Debug logs will show [GEOFENCE] tags from the distance calculation Is this still a good tag for this function? |
Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
…Distance Co-authored-by: MrAlders0n <55921894+MrAlders0n@users.noreply.github.com>
You're right! I've renamed the tag from |
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug where the map refresh service was calling a non-existent haversineDistance() function, causing a ReferenceError that broke GPS-based map updates. The fix corrects the function call to use the existing calculateHaversineDistance() function already used throughout the codebase.
- Fixed undefined function call in map refresh service (line 882)
- Renamed debug tags in
calculateHaversineDistance()from[GEOFENCE]to[HAVERSINE]to better reflect its usage across multiple contexts (map refresh, geofence validation, distance validation, RX batching)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The map refresh service was calling
haversineDistance()which doesn't exist, causingReferenceError: haversineDistance is not definedat line 882 and breaking GPS-based map updates.Changes
checkAndRefreshMap()to callcalculateHaversineDistance()- the existing function already used throughout the codebase for geofence and distance validation[GEOFENCE]to[HAVERSINE]incalculateHaversineDistance()to better reflect that this utility function is used across multiple contexts (map refresh, geofence validation, ping distance, RX batching)This enables the 25m GPS movement threshold for map refreshes and adds
[HAVERSINE]debug logging from the distance calculation utility.Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.