From 0281da4db5c542d92a791b9f653c50b1b3917ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Sun, 25 Dec 2016 08:11:13 +0100 Subject: [PATCH] dont show AlreadyThere if it's very unhelpfull --- src/c3nav/routing/graph.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/c3nav/routing/graph.py b/src/c3nav/routing/graph.py index c8ea597e..a73f2944 100644 --- a/src/c3nav/routing/graph.py +++ b/src/c3nav/routing/graph.py @@ -277,6 +277,15 @@ class Graph: if not len(orig_points_i) or not len(dest_points_i): raise NoRouteFound() + if orig_distances is None and dest_distances is None: + if set(dest_points_i) & set(orig_points_i): + orig_points_i = tuple(set(orig_points_i) - set(dest_points_i)) + if set(dest_points_i) & set(orig_points_i): + dest_points_i = tuple(set(dest_points_i) - set(orig_points_i)) + + if not len(orig_points_i) or not len(dest_points_i): + raise AlreadyThere() + add_orig_point = origin if isinstance(origin, PointLocation) else None add_dest_point = destination if isinstance(destination, PointLocation) else None @@ -306,7 +315,8 @@ class Graph: if common_points: # same location if not add_orig_point and not add_dest_point: - raise AlreadyThere() + #raise TypeError + pass#raise AlreadyThere() # points are connectable with only one via best_point = None