diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/blablalines.py b/source/jormungandr/jormungandr/scenarios/ridesharing/blablalines.py index 5e4a5c91dc..3680f7093c 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/blablalines.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/blablalines.py @@ -174,12 +174,12 @@ def _make_response(self, raw_json, request_datetime, from_coord, to_coord): return ridesharing_journeys - def _request_journeys(self, from_coord, to_coord, period_extremity, instance, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance, limit=None): """ :param from_coord: lat,lon ex: '48.109377,-1.682103' :param to_coord: lat,lon ex: '48.020335,-1.743929' - :param period_extremity: a tuple of [timestamp(utc), clockwise] + :param request_dates: a tuple of [timestamp(utc), timestamp(utc), clockwise] :param limit: optional :return: """ @@ -190,18 +190,18 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance, li dt = datetime.datetime.now() now = calendar.timegm(dt.utctimetuple()) - if period_extremity.datetime < now + MIN_BLABLALINES_MARGIN_DEPARTURE_TIME: + if request_dates.departure_datetime < now + MIN_BLABLALINES_MARGIN_DEPARTURE_TIME: logging.getLogger(__name__).info( 'blablalines ridesharing request departure time < now + 15 min. Force to now + 15 min' ) departure_epoch = now + MIN_BLABLALINES_MARGIN_DEPARTURE_TIME - elif period_extremity.datetime > now + MAX_BLABLALINES_MARGIN_DEPARTURE_TIME: + elif request_dates.departure_datetime > now + MAX_BLABLALINES_MARGIN_DEPARTURE_TIME: logging.getLogger(__name__).error( 'Blablalines error, request departure time should be between now to 1 week from now. departure is greater than now + 1 week' ) return [] else: - departure_epoch = period_extremity.datetime + departure_epoch = request_dates.departure_datetime # Paramaeters documenation : https://www.blablalines.com/public-api-v2 params = { @@ -225,7 +225,7 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance, li raise RidesharingServiceError('non 200 response', resp.status_code, resp.reason, resp.text) if resp: - r = self._make_response(resp.json(), period_extremity.datetime, from_coord, to_coord) + r = self._make_response(resp.json(), request_dates.departure_datetime, from_coord, to_coord) self.record_additional_info('Received ridesharing offers', nb_ridesharing_offers=len(r)) logging.getLogger('stat.ridesharing.blablalines').info( 'Received ridesharing offers : %s', diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/instant_system.py b/source/jormungandr/jormungandr/scenarios/ridesharing/instant_system.py index 7df1e6d121..be4fbdf48a 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/instant_system.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/instant_system.py @@ -230,22 +230,25 @@ def _make_response(self, raw_json, from_coord, to_coord, instance_params): return ridesharing_journeys - def _request_journeys(self, from_coord, to_coord, period_extremity, instance_params, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance_params, limit=None): """ :param from_coord: lat,lon ex: '48.109377,-1.682103' :param to_coord: lat,lon ex: '48.020335,-1.743929' - :param period_extremity: a tuple of [timestamp(utc), clockwise] + :param request_dates: a tuple of [timestamp(utc), timestamp(utc), clockwise] :param limit: optional :return: """ - # format of datetime: 2017-12-25T07:00:00Z - datetime_str = datetime.datetime.fromtimestamp(period_extremity.datetime, pytz.utc).strftime( - '%Y-%m-%dT%H:%M:%SZ' - ) - if period_extremity.represents_start: + if request_dates.represents_start: + # format of datetime: 2017-12-25T07:00:00Z + datetime_str = datetime.datetime.fromtimestamp(request_dates.departure_datetime, pytz.utc).strftime( + '%Y-%m-%dT%H:%M:%SZ' + ) datetime_str = '{}/PT{}S'.format(datetime_str, self.timeframe_duration) else: + datetime_str = datetime.datetime.fromtimestamp(request_dates.arrival_datetime, pytz.utc).strftime( + '%Y-%m-%dT%H:%M:%SZ' + ) datetime_str = 'PT{}S/{}'.format(self.timeframe_duration, datetime_str) params = { @@ -253,7 +256,7 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance_par 'to': to_coord, 'fromRadius': self.crowfly_radius, 'toRadius': self.crowfly_radius, - ('arrivalDate', 'departureDate')[bool(period_extremity.represents_start)]: datetime_str, + ('arrivalDate', 'departureDate')[bool(request_dates.represents_start)]: datetime_str, } if limit is not None: diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/karos.py b/source/jormungandr/jormungandr/scenarios/ridesharing/karos.py index 621b5a6ef0..7d2c9e7685 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/karos.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/karos.py @@ -177,12 +177,12 @@ def _make_response(self, raw_json): return ridesharing_journeys - def _request_journeys(self, from_coord, to_coord, period_extremity, instance, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance, limit=None): """ :param from_coord: lat,lon ex: '48.109377,-1.682103' :param to_coord: lat,lon ex: '48.020335,-1.743929' - :param period_extremity: a tuple of [timestamp(utc), clockwise] + :param request_dates: a tuple of [timestamp(utc), timestamp(utc), clockwise] :param limit: optional :return: """ @@ -195,7 +195,7 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance, li 'departureLng': dep_lon, 'arrivalLat': arr_lat, 'arrivalLng': arr_lon, - 'date': period_extremity.datetime, + 'date': request_dates.departure_datetime, 'timeDelta': self.timedelta, 'departureRadius': self.departure_radius, 'arrivalRadius': self.arrival_radius, diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/klaxit.py b/source/jormungandr/jormungandr/scenarios/ridesharing/klaxit.py index b1200b459f..28e9d01017 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/klaxit.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/klaxit.py @@ -162,12 +162,12 @@ def _make_response(self, raw_json): return ridesharing_journeys - def _request_journeys(self, from_coord, to_coord, period_extremity, instance, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance, limit=None): """ :param from_coord: lat,lon ex: '48.109377,-1.682103' :param to_coord: lat,lon ex: '48.020335,-1.743929' - :param period_extremity: a tuple of [timestamp(utc), clockwise] + :param request_dates: a tuple of [timestamp(utc), timestamp(utc), clockwise] :param limit: optional :return: """ @@ -182,7 +182,7 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance, li 'departureLng': dep_lon, 'arrivalLat': arr_lat, 'arrivalLng': arr_lon, - 'date': period_extremity.datetime, + 'date': request_dates.departure_datetime, 'timeDelta': self.timedelta, 'departureRadius': 2, 'arrivalRadius': 2, diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/ouestgo.py b/source/jormungandr/jormungandr/scenarios/ridesharing/ouestgo.py index acb5f51edc..49fe6bd562 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/ouestgo.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/ouestgo.py @@ -183,12 +183,12 @@ def _make_response(self, raw_json, request_datetime, from_coord, to_coord, timez return ridesharing_journeys - def _request_journeys(self, from_coord, to_coord, period_extremity, instance_params=None, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance_params=None, limit=None): """ :param from_coord: lat,lon ex: '48.109377,-1.682103' :param to_coord: lat,lon ex: '48.020335,-1.743929' - :param period_extremity: a tuple of [timestamp(utc), clockwise] + :param request_dates: a tuple of [timestamp(utc), timestamp(utc), clockwise] :param limit: optional :return: """ @@ -204,12 +204,12 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance_par 'p[to][latitude]': arr_lat, 'p[to][longitude]': arr_lon, 'signature': 'toto', - 'timestamp': period_extremity.datetime, + 'timestamp': request_dates.departure_datetime, 'p[outward][mindate]': timestamp_to_date_str( - period_extremity.datetime, timezone, _format=DATE_FORMAT + request_dates.departure_datetime, timezone, _format=DATE_FORMAT ), 'p[outward][maxdate]': timestamp_to_date_str( - period_extremity.datetime, timezone, _format=DATE_FORMAT + request_dates.departure_datetime, timezone, _format=DATE_FORMAT ), } @@ -230,7 +230,9 @@ def _request_journeys(self, from_coord, to_coord, period_extremity, instance_par # EVEN THOUGH the timezone is previously set in g. # We'd better retrieve the timezone from instance_params than relying on the g timezone = get_timezone_or_paris() if instance_params is None else instance_params.timezone - r = self._make_response(resp.json(), period_extremity.datetime, from_coord, to_coord, timezone) + r = self._make_response( + resp.json(), request_dates.departure_datetime, from_coord, to_coord, timezone + ) self.record_additional_info('Received ridesharing offers', nb_ridesharing_offers=len(r)) logging.getLogger('stat.ridesharing.ouestgo').info( 'Received ridesharing offers : %s', diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service.py b/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service.py index c1cc81af13..d128b03564 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service.py @@ -112,7 +112,7 @@ def _call_service(self, params, headers={}, verify=True): raise RidesharingServiceError(str(e)) def request_journeys_with_feed_publisher( - self, from_coord, to_coord, period_extremity, instance_params, limit=None + self, from_coord, to_coord, request_dates, instance_params, limit=None ): """ This function shouldn't be overwritten! @@ -120,7 +120,7 @@ def request_journeys_with_feed_publisher( :return: a list(mandatory) contains solutions and a feed_publisher """ try: - journeys = self._request_journeys(from_coord, to_coord, period_extremity, instance_params, limit) + journeys = self._request_journeys(from_coord, to_coord, request_dates, instance_params, limit) feed_publisher = self._get_feed_publisher() self.record_call('ok') @@ -132,7 +132,7 @@ def request_journeys_with_feed_publisher( return [], None @abc.abstractmethod - def _request_journeys(self, from_coord, to_coord, period_extremity, instance_params, limit=None): + def _request_journeys(self, from_coord, to_coord, request_dates, instance_params, limit=None): """ :return: a list(mandatory) contains solutions """ diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py b/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py index 79a0918b08..cf21c4a5ba 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py @@ -39,7 +39,7 @@ from jormungandr.utils import get_pt_object_coord, generate_id from jormungandr.street_network.utils import crowfly_distance_between from navitiacommon import response_pb2 -from jormungandr.utils import PeriodExtremity +from jormungandr.utils import RequestDates from jormungandr.scenarios.journey_filter import to_be_deleted from jormungandr.scenarios.helper_classes.helper_future import FutureManager from importlib import import_module @@ -198,27 +198,29 @@ def decorate_journeys_with_ridesharing_offers(self, response, request, instance) for section_idx, section in enumerate(journey.sections): if section.street_network.mode == response_pb2.Ridesharing: section.additional_informations.append(response_pb2.HAS_DATETIME_ESTIMATED) - period_extremity = None + request_dates = None if len(journey.sections) == 1: # direct path, we use the user input - period_extremity = PeriodExtremity(request['datetime'], request['clockwise']) + request_dates = RequestDates( + request['datetime'], request['datetime'], request['clockwise'] + ) elif ( section_idx == 0 ): # ridesharing on first section we want to arrive before the start of the pt - period_extremity = PeriodExtremity(section.end_date_time, False) + request_dates = RequestDates(section.begin_date_time, section.end_date_time, False) else: # ridesharing at the end, we search for solution starting after the end of the pt sections - period_extremity = PeriodExtremity(section.begin_date_time, True) + request_dates = RequestDates(section.begin_date_time, section.end_date_time, True) instance_params = self.InstanceParams.make_params(instance) if greenlet_pool_actived: futures[journey_idx][section_idx] = future_manager.create_future( self.build_ridesharing_journeys, section.origin, section.destination, - period_extremity, + request_dates, instance_params, ) else: pb_rsjs, pb_tickets, pb_fps = self.build_ridesharing_journeys( - section.origin, section.destination, period_extremity, instance_params + section.origin, section.destination, request_dates, instance_params ) self.add_new_ridesharing_results( pb_rsjs, pb_tickets, pb_fps, response, journey_idx, section_idx @@ -242,7 +244,7 @@ def add_new_ridesharing_results(self, pb_rsjs, pb_tickets, pb_fps, response, jou response.feed_publishers.extend((fp for fp in pb_fps if fp not in response.feed_publishers)) def get_ridesharing_journeys_with_feed_publishers( - self, from_coord, to_coord, period_extremity, instance_params, limit=None + self, from_coord, to_coord, request_dates, instance_params, limit=None ): calls = [] res = [] @@ -252,7 +254,7 @@ def get_ridesharing_journeys_with_feed_publishers( def _call(s=service): return s.request_journeys_with_feed_publisher( - from_coord, to_coord, period_extremity, instance_params, limit + from_coord, to_coord, request_dates, instance_params, limit ) calls.append(_call) @@ -271,14 +273,14 @@ def _call(s=service): return res, fps - def build_ridesharing_journeys(self, from_pt_obj, to_pt_obj, period_extremity, instance_params): + def build_ridesharing_journeys(self, from_pt_obj, to_pt_obj, request_dates, instance_params): from_coord = get_pt_object_coord(from_pt_obj) to_coord = get_pt_object_coord(to_pt_obj) from_str = "{},{}".format(from_coord.lat, from_coord.lon) to_str = "{},{}".format(to_coord.lat, to_coord.lon) try: rsjs, fps = self.get_ridesharing_journeys_with_feed_publishers( - from_str, to_str, period_extremity, instance_params + from_str, to_str, request_dates, instance_params ) except Exception as e: self.logger.exception( @@ -304,7 +306,7 @@ def build_ridesharing_journeys(self, from_pt_obj, to_pt_obj, period_extremity, i pickup_coord = get_pt_object_coord(pb_rsj_pickup) dropoff_coord = get_pt_object_coord(pb_rsj_dropoff) - pb_rsj.requested_date_time = period_extremity.datetime + pb_rsj.requested_date_time = request_dates.departure_datetime if rsj.departure_date_time: pb_rsj.departure_date_time = rsj.departure_date_time if rsj.arrival_date_time: diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/blablalines_tests.py b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/blablalines_tests.py index f44ad65047..d8b79aa5f3 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/blablalines_tests.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/blablalines_tests.py @@ -146,13 +146,15 @@ def blablalines_test(): from_coord = '47.28696,0.78981' to_coord = '47.38642,0.69039' - period_extremity = utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + request_dates = utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ) ridesharing_journeys, feed_publisher = blablalines.request_journeys_with_feed_publisher( from_coord=from_coord, to_coord=to_coord, - period_extremity=period_extremity, + request_dates=request_dates, instance_params=DummyInstance(), ) @@ -215,8 +217,10 @@ def test_request_journeys_should_raise_on_non_200(): blablalines._request_journeys( '1.2,3.4', '5.6,7.8', - utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ), DummyInstance(), ) diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/instant_system_tests.py b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/instant_system_tests.py index f945518b0e..346ece9aa3 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/instant_system_tests.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/instant_system_tests.py @@ -250,13 +250,14 @@ def instant_system_test(): from_coord = '48.109377,-1.682103' to_coord = '48.020335,-1.743929' - period_extremity = utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + request_dates = utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ) - params = RidesharingServiceManager.InstanceParams.make_params(DummyInstance()) ridesharing_journeys, feed_publisher = instant_system.request_journeys_with_feed_publisher( - from_coord=from_coord, to_coord=to_coord, period_extremity=period_extremity, instance_params=params + from_coord=from_coord, to_coord=to_coord, request_dates=request_dates, instance_params=params ) assert len(ridesharing_journeys) == 2 @@ -347,8 +348,10 @@ def test_request_journeys_should_raise_on_non_200(): instant_system._request_journeys( '1.2,3.4', '5.6,7.8', - utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ), DummyInstance(), ) diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/karos_tests.py b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/karos_tests.py index c550904f44..6bf6262c26 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/karos_tests.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/karos_tests.py @@ -255,12 +255,14 @@ def karos_service_test(): from_coord = '47.28696,0.78981' to_coord = '47.38642,0.69039' - period_extremity = utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + request_dates = utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ) params = RidesharingServiceManager.InstanceParams.make_params(DummyInstance) ridesharing_journeys, feed_publisher = karos.request_journeys_with_feed_publisher( - from_coord=from_coord, to_coord=to_coord, period_extremity=period_extremity, instance_params=params + from_coord=from_coord, to_coord=to_coord, request_dates=request_dates, instance_params=params ) assert len(ridesharing_journeys) == 2 @@ -334,8 +336,10 @@ def test_request_journeys_should_raise_on_non_200(): karos._request_journeys( '1.2,3.4', '5.6,7.8', - utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ), DummyInstance(), ) diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/klaxit_tests.py b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/klaxit_tests.py index e7210d71c8..21bc3e266a 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/klaxit_tests.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/klaxit_tests.py @@ -170,12 +170,14 @@ def klaxit_service_test(): from_coord = '47.28696,0.78981' to_coord = '47.38642,0.69039' - period_extremity = utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + request_dates = utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ) params = RidesharingServiceManager.InstanceParams.make_params(DummyInstance()) ridesharing_journeys, feed_publisher = klaxit.request_journeys_with_feed_publisher( - from_coord=from_coord, to_coord=to_coord, period_extremity=period_extremity, instance_params=params + from_coord=from_coord, to_coord=to_coord, request_dates=request_dates, instance_params=params ) assert len(ridesharing_journeys) == 2 @@ -243,8 +245,10 @@ def test_request_journeys_should_raise_on_non_200(): klaxit._request_journeys( '1.2,3.4', '5.6,7.8', - utils.PeriodExtremity( - datetime=utils.str_to_time_stamp("20171225T060000"), represents_start=True + utils.RequestDates( + departure_datetime=utils.str_to_time_stamp("20171225T060000"), + arrival_datetime=utils.str_to_time_stamp("20171225T060000"), + represents_start=True, ), DummyInstance(), ) diff --git a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/ouestgo_tests.py b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/ouestgo_tests.py index fb0c19e2ab..f78752d28a 100644 --- a/source/jormungandr/jormungandr/scenarios/ridesharing/tests/ouestgo_tests.py +++ b/source/jormungandr/jormungandr/scenarios/ridesharing/tests/ouestgo_tests.py @@ -194,13 +194,15 @@ def ouestgo_basic_test(): from_coord = '48.68793,6.171514' to_coord = '49.108385,6.194897' - period_extremity = utils.PeriodExtremity( - datetime=utils.make_timestamp_from_str("20221121T084122"), represents_start=True + request_dates = utils.RequestDates( + departure_datetime=utils.make_timestamp_from_str("20221121T084122"), + arrival_datetime=utils.make_timestamp_from_str("20221121T084122"), + represents_start=True, ) ridesharing_journeys, feed_publisher = ouestgo.request_journeys_with_feed_publisher( from_coord=from_coord, to_coord=to_coord, - period_extremity=period_extremity, + request_dates=request_dates, instance_params=DummyInstance(), ) @@ -246,8 +248,10 @@ def test_request_journeys_should_raise_on_non_200(): ouestgo._request_journeys( '1.2,3.4', '5.6,7.8', - utils.PeriodExtremity( - datetime=utils.make_timestamp_from_str("20221121T084122"), represents_start=True + utils.RequestDates( + departure_datetime=utils.make_timestamp_from_str("20221121T084122"), + arrival_datetime=utils.make_timestamp_from_str("20221121T084122"), + represents_start=True, ), DummyInstance(), ) diff --git a/source/jormungandr/jormungandr/utils.py b/source/jormungandr/jormungandr/utils.py index 172197e2cb..650080faa4 100644 --- a/source/jormungandr/jormungandr/utils.py +++ b/source/jormungandr/jormungandr/utils.py @@ -709,6 +709,11 @@ def encode_polyline(coords, precision=6): # (mostly used for fallback management in experimental scenario) PeriodExtremity = namedtuple('PeriodExtremity', ['datetime', 'represents_start']) +# RequestDates is used by ridesharing services +# instant_system needs both departure_datetime and arrival_datetime +# other services use only departure_datetime without any condition +RequestDates = namedtuple('RequestDates', ['departure_datetime', 'arrival_datetime', 'represents_start']) + class SectionSorter(object): def __call__(self, a, b):