Skip to content

Commit

Permalink
Merge pull request #4249 from hove-io/fix_isochrone_when_asgard_is_as…
Browse files Browse the repository at this point in the history
…signed

[Graphical Isochrone] Fix isochrone when asgard is chosen
  • Loading branch information
xlqian authored Mar 22, 2024
2 parents 57f23e2 + b12ea87 commit 18f9fb6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
33 changes: 0 additions & 33 deletions source/jormungandr/jormungandr/interfaces/v1/Journeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
UnsignedInteger,
PositiveInteger,
DepthArgument,
PositiveFloat,
)
from jormungandr.interfaces.common import add_poi_infos_types, handle_poi_infos
from jormungandr.fallback_modes import FallbackModes
Expand Down Expand Up @@ -672,35 +671,6 @@ def __init__(self):
help="Compute pathways using the street_network engine for transfers between surface physical modes",
)

parser_get.add_argument(
"_asgard_max_walking_duration_coeff",
type=PositiveFloat(),
default=1.12,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_bike_duration_coeff",
type=PositiveFloat(),
default=2.8,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_bss_duration_coeff",
type=PositiveFloat(),
default=0.46,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_car_duration_coeff",
type=PositiveFloat(),
default=1,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)

parser_get.add_argument(
"_loki_pt_journey_fare",
type=OptionValue(['kraken']),
Expand Down Expand Up @@ -856,9 +826,6 @@ def _set_specific_params(mod):
if args.get('_loki_compute_pt_journey_fare') is None:
args['_loki_compute_pt_journey_fare'] = mod.loki_compute_pt_journey_fare

if args.get('_use_excluded_zones') is None:
args['_use_excluded_zones'] = app.config['USE_EXCLUDED_ZONES']

# When computing 'same_journey_schedules'(is_journey_schedules=True), some parameters need to be overridden
# because they are contradictory to the request
if args.get("is_journey_schedules"):
Expand Down
34 changes: 33 additions & 1 deletion source/jormungandr/jormungandr/interfaces/v1/journey_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# www.navitia.io

from __future__ import absolute_import, print_function, unicode_literals, division
from jormungandr import i_manager, fallback_modes, partner_services
from jormungandr import i_manager, fallback_modes, partner_services, app
from jormungandr.interfaces.v1.ResourceUri import ResourceUri
from datetime import datetime
from jormungandr.resources_utils import ResourceUtc
Expand All @@ -56,6 +56,7 @@
SpeedRange,
FloatRange,
KeyValueType,
PositiveFloat,
)
from navitiacommon import type_pb2

Expand Down Expand Up @@ -788,6 +789,34 @@ def __init__(self, output_type_serializer):
help="only available for Asgard so far: take into account excluded zones pre-defined in Asgard, "
"Warning: this feature may be performance impacting.",
)
parser_get.add_argument(
"_asgard_max_walking_duration_coeff",
type=PositiveFloat(),
default=1.12,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_bike_duration_coeff",
type=PositiveFloat(),
default=2.8,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_bss_duration_coeff",
type=PositiveFloat(),
default=0.46,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)
parser_get.add_argument(
"_asgard_max_car_duration_coeff",
type=PositiveFloat(),
default=1,
hidden=True,
help="used to adjust the search range in Asgard when computing matrix",
)

def parse_args(self, region=None, uri=None):
args = self.parsers['get'].parse_args()
Expand Down Expand Up @@ -818,6 +847,9 @@ def parse_args(self, region=None, uri=None):
if 'last_section_mode' in args and args['last_section_mode']:
args['destination_mode'] = args['last_section_mode']

if args.get('_use_excluded_zones') is None:
args['_use_excluded_zones'] = app.config['USE_EXCLUDED_ZONES']

if region:
if uri:
objects = uri.split('/')
Expand Down

0 comments on commit 18f9fb6

Please sign in to comment.