From 907b3154a9cdf91622a0682ea4ca36d4921ca2b9 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Thu, 18 Jan 2018 12:30:07 +0100 Subject: [PATCH] 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 --- ffmap/db/hooddata.py | 5 +++++ ffmap/routertools.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ffmap/db/hooddata.py b/ffmap/db/hooddata.py index 84440d7..8666fce 100755 --- a/ffmap/db/hooddata.py +++ b/ffmap/db/hooddata.py @@ -10,6 +10,11 @@ import math mysql = FreifunkMySQL() hoods = [ +{ + "keyxchange_id": 0, + "name": "NoCoordinates", + "net": "" +}, { "keyxchange_id": 1, "name": "Default", diff --git a/ffmap/routertools.py b/ffmap/routertools.py index efac02a..1b9ec91 100644 --- a/ffmap/routertools.py +++ b/ffmap/routertools.py @@ -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