|
@@ -29,7 +29,8 @@ class MarkerCreateView(PermissionRequiredMixin, View):
|
|
continue
|
|
continue
|
|
objects = [Marker(
|
|
objects = [Marker(
|
|
timestamp=datetime.strptime(x['timestamp'].replace("Z","-0000"), r"%Y-%m-%dT%H:%M:%S.%f%z"),
|
|
timestamp=datetime.strptime(x['timestamp'].replace("Z","-0000"), r"%Y-%m-%dT%H:%M:%S.%f%z"),
|
|
- location = Point(x['lng'], x['lat'], x['alt']),
|
|
|
|
|
|
+ location = Point(x['lng'], x['lat']),
|
|
|
|
+ alt = x['alt'],
|
|
hdop = x.get('hdop', None),
|
|
hdop = x.get('hdop', None),
|
|
speed = x.get('speed', None)
|
|
speed = x.get('speed', None)
|
|
) for x in data[file]]
|
|
) for x in data[file]]
|
|
@@ -47,7 +48,7 @@ class MarkerCreateView(PermissionRequiredMixin, View):
|
|
if identical:
|
|
if identical:
|
|
for i, marker in enumerate(oldMarkers):
|
|
for i, marker in enumerate(oldMarkers):
|
|
objects[i].id = marker.id
|
|
objects[i].id = marker.id
|
|
- Marker.objects.bulk_update(objects, ['timestamp', 'location', 'hdop', 'speed'])
|
|
|
|
|
|
+ Marker.objects.bulk_update(objects, ['location', 'alt', 'hdop', 'speed'])
|
|
replace_count += len(oldMarkers)
|
|
replace_count += len(oldMarkers)
|
|
else:
|
|
else:
|
|
insert_count += len(objects) - len(oldMarkers)
|
|
insert_count += len(objects) - len(oldMarkers)
|
|
@@ -71,7 +72,6 @@ def marker_view(request):
|
|
if location:
|
|
if location:
|
|
marker['lng'] = location.x
|
|
marker['lng'] = location.x
|
|
marker['lat'] = location.y
|
|
marker['lat'] = location.y
|
|
- marker['alt'] = location.z
|
|
|
|
del marker['location']
|
|
del marker['location']
|
|
data = json.dumps(values, cls=DjangoJSONEncoder)
|
|
data = json.dumps(values, cls=DjangoJSONEncoder)
|
|
cache.set('markers', data, 3600*24)
|
|
cache.set('markers', data, 3600*24)
|