From 7186d483830e6dbc3266686cb76fababb9353f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Thu, 21 Dec 2023 01:00:05 +0100 Subject: [PATCH] make prefer restrictions work right --- src/c3nav/routing/router.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/c3nav/routing/router.py b/src/c3nav/routing/router.py index 23f1afaf..e3af7ce9 100644 --- a/src/c3nav/routing/router.py +++ b/src/c3nav/routing/router.py @@ -445,7 +445,11 @@ class Router: # prefer/avoid restrictions restrictions_setting = options.get("restrictions", "normal") if restrictions_setting != "normal": - factor = 100000 if restrictions_setting == "avoid" else 1/100000 + if restrictions_setting == "avoid": + factor = 100000 + else: + graph *= 100000 + factor = 1/100000 all_restrictions = RouterRestrictionSet(self.restrictions.items()) space_nodes = tuple(reduce(operator.or_, (self.spaces[space].nodes for space in all_restrictions.spaces), set()))