api/alfred: Introduce NoCoordinates hood

Previously, mesh routers without coordinates are assigned to the
default hood, even if they are meshing with routers from other
hoods.

To keep the default hood clean, we introduce the "NoCoordinates"
hood for all those routers.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-01-18 12:30:07 +01:00
parent 4dab09748c
commit 907b3154a9
2 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,11 @@ import math
mysql = FreifunkMySQL()
hoods = [
{
"keyxchange_id": 0,
"name": "NoCoordinates",
"net": ""
},
{
"keyxchange_id": 1,
"name": "Default",

View File

@ -106,6 +106,8 @@ def import_nodewatcher_xml(mysql, mac, xml, banned, netifdict):
""",(lat,lng,lat,),"name")
if not router_update["hood"]:
router_update["hood"] = "Default"
if router_update["neighbours"] and not router_update["has_wan_uplink"]:
router_update["hood"] = "NoCoordinates"
if not router_update['lat'] and not router_update['lng'] and olddata and olddata['lat'] and olddata['lng']:
# Enable reset state; do before variable fallback
reset = True