From 3ae510abf733cda955c72a2826de8b9630f91688 Mon Sep 17 00:00:00 2001 From: Abderrahim AZIME Date: Tue, 9 Jul 2024 16:56:47 +0200 Subject: [PATCH 1/2] Fix: Select max_duration by StreetNetworkPathType --- source/jormungandr/jormungandr/street_network/asgard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/jormungandr/jormungandr/street_network/asgard.py b/source/jormungandr/jormungandr/street_network/asgard.py index 28b9bce11d..4a0d62fba5 100644 --- a/source/jormungandr/jormungandr/street_network/asgard.py +++ b/source/jormungandr/jormungandr/street_network/asgard.py @@ -429,10 +429,10 @@ def _direct_path( # bigger than max_{mode}_direct_path_distance don't compute direct_path if crowfly_distance > int(request['max_{mode}_direct_path_distance'.format(mode=mode)]): return response_pb2.Response() - + max_duration_param_name = 'max_{mode}_direct_path_duration'.format(mode=mode) if direct_path_type == StreetNetworkPathType.DIRECT else 'max_{mode}_duration_to_pt'.format(mode=mode) if ( crowfly_distance / float(request['{mode}_speed'.format(mode=mode)]) - > request['max_{mode}_direct_path_duration'.format(mode=mode)] + > request[max_duration_param_name] ): return response_pb2.Response() From 8a6130bcccc53baa24d0fced8e521491d0222868 Mon Sep 17 00:00:00 2001 From: Abderrahim AZIME Date: Tue, 9 Jul 2024 17:08:04 +0200 Subject: [PATCH 2/2] pre-commit --- source/jormungandr/jormungandr/street_network/asgard.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/jormungandr/jormungandr/street_network/asgard.py b/source/jormungandr/jormungandr/street_network/asgard.py index 4a0d62fba5..b732895b61 100644 --- a/source/jormungandr/jormungandr/street_network/asgard.py +++ b/source/jormungandr/jormungandr/street_network/asgard.py @@ -429,7 +429,11 @@ def _direct_path( # bigger than max_{mode}_direct_path_distance don't compute direct_path if crowfly_distance > int(request['max_{mode}_direct_path_distance'.format(mode=mode)]): return response_pb2.Response() - max_duration_param_name = 'max_{mode}_direct_path_duration'.format(mode=mode) if direct_path_type == StreetNetworkPathType.DIRECT else 'max_{mode}_duration_to_pt'.format(mode=mode) + max_duration_param_name = ( + 'max_{mode}_direct_path_duration'.format(mode=mode) + if direct_path_type == StreetNetworkPathType.DIRECT + else 'max_{mode}_duration_to_pt'.format(mode=mode) + ) if ( crowfly_distance / float(request['{mode}_speed'.format(mode=mode)]) > request[max_duration_param_name]