06/11 Update Inspection result will include GPS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user