Skip to content

Commit f89a045

Browse files
committed
update proto-navitia; add use_excluded_zones
1 parent c9f824e commit f89a045

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

source/jormungandr/jormungandr/default_settings.py

+2
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,5 @@
401401

402402
PT_FARES_KRAKEN_TIMEOUT = float(os.getenv('JORMUNGANDR_PT_FARES_KRAKEN_TIMEOUT', 0.1)) # second
403403
PT_FARES_KRAKEN_ATTEMPT_NUMBER = int(os.getenv('JORMUNGANDR_PT_FARES_KRAKEN_ATTEMPT_NUMBER', 2))
404+
405+
USE_EXCLUDED_ZONES = boolean(os.getenv('JORMUNGANDR_USE_EXCLUDED_ZONES', False))

source/jormungandr/jormungandr/interfaces/v1/Journeys.py

+3
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,9 @@ def _set_specific_params(mod):
856856
if args.get('_loki_compute_pt_journey_fare') is None:
857857
args['_loki_compute_pt_journey_fare'] = mod.loki_compute_pt_journey_fare
858858

859+
if args.get('_use_excluded_zones') is None:
860+
args['_use_excluded_zones'] = app.config['USE_EXCLUDED_ZONES']
861+
859862
# When computing 'same_journey_schedules'(is_journey_schedules=True), some parameters need to be overridden
860863
# because they are contradictory to the request
861864
if args.get("is_journey_schedules"):

source/jormungandr/jormungandr/interfaces/v1/journey_common.py

+9
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,15 @@ def __init__(self, output_type_serializer):
768768
help="only available for Asgard: " "Ignore when encountering roads that are oneway.",
769769
)
770770

771+
parser_get.add_argument(
772+
"_use_excluded_zones",
773+
type=BooleanType(),
774+
hidden=True,
775+
default=False,
776+
help="only available for Asgard so far: take into account excluded zones pre-defined in Asgard, "
777+
"Warning: this feature may be performance impacting.",
778+
)
779+
771780
def parse_args(self, region=None, uri=None):
772781
args = self.parsers['get'].parse_args()
773782

source/jormungandr/jormungandr/street_network/utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def create_kraken_direct_path_request(
9696
req.direct_path.origin.CopyFrom(connector.make_location(pt_object_origin))
9797
req.direct_path.destination.CopyFrom(connector.make_location(pt_object_destination))
9898
req.direct_path.datetime = fallback_extremity.datetime
99+
req.direct_path.use_excluded_zones = request['_use_excluded_zones']
99100
req.direct_path.clockwise = fallback_extremity.represents_start
100101
req.direct_path.streetnetwork_params.origin_mode = connector.handle_car_no_park_modes(mode)
101102
req.direct_path.streetnetwork_params.destination_mode = connector.handle_car_no_park_modes(mode)
@@ -148,6 +149,7 @@ def create_kraken_matrix_request(
148149
"car_no_park", kwargs.get("car_no_park")
149150
)
150151
req.sn_routing_matrix.datetime = request["datetime"]
152+
req.sn_routing_matrix.use_excluded_zones = request["_use_excluded_zones"]
151153
return req
152154

153155

source/navitia-proto

0 commit comments

Comments
 (0)