fucking fix it for us, pls
This commit is contained in:
parent
8a8958cf31
commit
980d9c0b32
2 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@ import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from celery.exceptions import MaxRetriesExceededError
|
from celery.exceptions import MaxRetriesExceededError
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.formats import date_format
|
from django.utils.formats import date_format
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
@ -57,7 +58,8 @@ def delete_map_cache_key(self, cache_key):
|
||||||
|
|
||||||
|
|
||||||
@app.task(bind=True, max_retries=10)
|
@app.task(bind=True, max_retries=10)
|
||||||
def update_ap_names_bssid_mapping(self, map_name, user):
|
def update_ap_names_bssid_mapping(self, map_name, user_id):
|
||||||
|
user = get_user_model().objects.filter(pk=user_id)
|
||||||
from c3nav.mapdata.models.geometry.space import RangingBeacon
|
from c3nav.mapdata.models.geometry.space import RangingBeacon
|
||||||
todo = []
|
todo = []
|
||||||
for beacon in RangingBeacon.objects.filter(ap_name__in=map_name.keys(),
|
for beacon in RangingBeacon.objects.filter(ap_name__in=map_name.keys(),
|
||||||
|
|
|
@ -61,7 +61,7 @@ def get_position(request, parameters: LocateRequestSchema):
|
||||||
if bssid_mapping:
|
if bssid_mapping:
|
||||||
update_ap_names_bssid_mapping.delay(
|
update_ap_names_bssid_mapping.delay(
|
||||||
map_name={str(name): [str(b) for b in bssids] for name, bssids in bssid_mapping.items()},
|
map_name={str(name): [str(b) for b in bssids] for name, bssids in bssid_mapping.items()},
|
||||||
user=request.user
|
user_id=request.user.pk
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue