06/11 Update Inspection result will include GPS

This commit is contained in:
2026-06-11 13:57:41 -04:00
parent 99546f4ed7
commit 079e826a7a
6 changed files with 98 additions and 2 deletions
+10
View File
@@ -533,6 +533,16 @@ def execute(inspection_id):
inspection.status = 'completed'
inspection.completed_at = now_eastern()
# Capture GPS coordinates submitted by the browser Geolocation API
try:
_lat = request.form.get('submit_lat', '').strip()
_lng = request.form.get('submit_lng', '').strip()
if _lat and _lng:
inspection.submit_latitude = float(_lat)
inspection.submit_longitude = float(_lng)
except (ValueError, TypeError):
pass
# Snapshot the current template schema so view() renders correctly
# even if the template is later edited or deleted.
_save_responses(inspection, responses, snapshot_schema=form_fields)