create mapupdate in bssid from scans to beacons
This commit is contained in:
parent
10f6804423
commit
879520a7cd
2 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
|
from c3nav.mapdata.models import MapUpdate
|
||||||
from c3nav.mapdata.models.geometry.space import BeaconMeasurement
|
from c3nav.mapdata.models.geometry.space import BeaconMeasurement
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,4 +10,6 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
BeaconMeasurement.contribute_bssid_to_beacons(BeaconMeasurement.objects.all())
|
with MapUpdate.lock():
|
||||||
|
BeaconMeasurement.contribute_bssid_to_beacons(BeaconMeasurement.objects.all())
|
||||||
|
MapUpdate.objects.create(type='bssids_from_scans_to_beacons')
|
||||||
|
|
|
@ -471,6 +471,7 @@ class BeaconMeasurement(SpaceGeometryMixin, models.Model):
|
||||||
if peer.ap_name:
|
if peer.ap_name:
|
||||||
map_name.setdefault(peer.ap_name, []).append(peer.bssid)
|
map_name.setdefault(peer.ap_name, []).append(peer.bssid)
|
||||||
for beacon in RangingBeacon.objects.filter(ap_name__in=map_name.keys()):
|
for beacon in RangingBeacon.objects.filter(ap_name__in=map_name.keys()):
|
||||||
|
print(beacon, "add ssids", set(map_name[beacon.ap_name]))
|
||||||
beacon.wifi_bssids = list(set(beacon.wifi_bssids) | set(map_name[beacon.ap_name]))
|
beacon.wifi_bssids = list(set(beacon.wifi_bssids) | set(map_name[beacon.ap_name]))
|
||||||
beacon.save()
|
beacon.save()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue