Fixes some issues with the location button being invisible (#207)
* Fakemobileclient should return a dict of wifi.data, instead of data, since we have bluetooth beacons too * Use dict instead of list for beacon measurement in fakemobileclient and editor script * Use distance directly * BeaconMeasurementDataSchema add default * Route from current location * Do not try to set Score if no location found
This commit is contained in:
parent
82b13e16a0
commit
ebfc683f7c
3 changed files with 7 additions and 3 deletions
|
@ -42,7 +42,7 @@ class PositioningResult(BaseSchema):
|
|||
response={200: PositioningResult, **auth_responses})
|
||||
def get_position(request, parameters: LocateRequestSchema):
|
||||
try:
|
||||
location = Locator.load().locate(parameters.dict()["wifi_peers"],
|
||||
location = Locator.load().locate(parameters.wifi_peers,
|
||||
permissions=AccessPermission.get_for_request(request))
|
||||
if location is not None:
|
||||
# todo: this will overload us probably, group these
|
||||
|
|
|
@ -224,7 +224,8 @@ class Locator:
|
|||
best_location = location
|
||||
best_score = score
|
||||
|
||||
best_location.score = best_score
|
||||
if best_location is not None:
|
||||
best_location.score = best_score
|
||||
|
||||
return best_location
|
||||
|
||||
|
|
|
@ -1508,7 +1508,7 @@ c3nav = {
|
|||
}
|
||||
|
||||
// setup user location control
|
||||
if (c3nav.ssids) c3nav._userLocationControl = new UserLocationControl().addTo(c3nav.map);
|
||||
if ($main.is('[data-ssids]')) c3nav._userLocationControl = new UserLocationControl().addTo(c3nav.map);
|
||||
|
||||
L.control.zoom({
|
||||
position: 'bottomright'
|
||||
|
@ -2036,6 +2036,7 @@ c3nav = {
|
|||
}
|
||||
if (location) {
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('my_location'));
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').show();
|
||||
var latlng = L.GeoJSON.coordsToLatLng(location.geometry.coordinates);
|
||||
for (level in c3nav._userLocationLayers) {
|
||||
if (!c3nav._userLocationLayers.hasOwnProperty(level)) continue;
|
||||
|
@ -2055,9 +2056,11 @@ c3nav = {
|
|||
$('.leaflet-control-user-location a').toggleClass('control-disabled', false);
|
||||
} else if (c3nav.hasLocationPermission()) {
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_searching'));
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').show();
|
||||
$('.leaflet-control-user-location a').toggleClass('control-disabled', false);
|
||||
} else {
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').text(c3nav._map_material_icon('location_disabled'));
|
||||
$('.locationinput .locate, .leaflet-control-user-location a').hide();
|
||||
$('.leaflet-control-user-location a').toggleClass('control-disabled', true);
|
||||
}
|
||||
if (typeof mobileclient !== 'undefined' && mobileclient.isCurrentLocationRequested && mobileclient.isCurrentLocationRequested()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue