don't add location not found to stats

This commit is contained in:
Laura Klünder 2018-12-25 20:12:24 +01:00
parent d4b596e25e
commit a2aded34aa

View file

@ -96,7 +96,8 @@ class RoutingViewSet(ViewSet):
def locate(self, request, *args, **kwargs):
try:
location = Locator.load().locate(request.data, permissions=AccessPermission.get_for_request(request))
increment_cache_key('apistats__locate__%s' % location.pk)
if location is not None:
increment_cache_key('apistats__locate__%s' % location.pk)
except ValidationError:
return Response({
'errors': (_('Invalid scan data.'),),