From 34f3e85f2ca91c1aab03bd48ac551561a3bed261 Mon Sep 17 00:00:00 2001 From: ArnaudOggy Date: Fri, 6 Sep 2024 18:02:34 +0200 Subject: [PATCH 1/5] StopTime - Move arrival_time and departure_time to Option --- src/enhancers/check_stop_times_order.rs | 12 ++-- src/enhancers/enhance_pickup_dropoff.rs | 30 ++++++---- src/gtfs/read.rs | 75 ++++++++++++++++--------- src/gtfs/write.rs | 40 ++++++++----- src/model.rs | 65 +++++++++++++++------ src/model_builder.rs | 6 +- src/netex_france/offer.rs | 64 +++++++++++++-------- src/netex_france/route_points.rs | 6 +- src/ntfs/mod.rs | 24 +++++--- src/ntfs/read.rs | 32 +++++++---- src/ntfs/write.rs | 2 + src/objects.rs | 34 ++++++----- 12 files changed, 261 insertions(+), 129 deletions(-) diff --git a/src/enhancers/check_stop_times_order.rs b/src/enhancers/check_stop_times_order.rs index 50fed2bb4..fab0562ab 100644 --- a/src/enhancers/check_stop_times_order.rs +++ b/src/enhancers/check_stop_times_order.rs @@ -35,8 +35,10 @@ mod tests { StopTime { stop_point_idx, sequence: 0, - arrival_time: Time::from_str(a_arrival).unwrap(), - departure_time: Time::from_str(a_departure).unwrap(), + arrival_time: Time::from_str(a_arrival).ok(), + departure_time: Time::from_str(a_departure).ok(), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -47,8 +49,10 @@ mod tests { StopTime { stop_point_idx, sequence: 1, - arrival_time: FromStr::from_str(b_arrival).unwrap(), - departure_time: FromStr::from_str(b_departure).unwrap(), + arrival_time: FromStr::from_str(b_arrival).ok(), + departure_time: FromStr::from_str(b_departure).ok(), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, diff --git a/src/enhancers/enhance_pickup_dropoff.rs b/src/enhancers/enhance_pickup_dropoff.rs index 067b273b3..20aaad930 100644 --- a/src/enhancers/enhance_pickup_dropoff.rs +++ b/src/enhancers/enhance_pickup_dropoff.rs @@ -201,8 +201,10 @@ mod tests { let stop_time_1 = StopTime { stop_point_idx: sp_idxs[0], sequence: 0, - arrival_time: prev_vj_config.2 - Time::new(1, 0, 0), - departure_time: prev_vj_config.3 - Time::new(1, 0, 0), + arrival_time: Some(prev_vj_config.2 - Time::new(1, 0, 0)), + departure_time: Some(prev_vj_config.3 - Time::new(1, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -214,8 +216,10 @@ mod tests { let stop_time_2 = StopTime { stop_point_idx: sp_idxs[prev_vj_config.1], sequence: 0, - arrival_time: prev_vj_config.2, - departure_time: prev_vj_config.3, + arrival_time: Some(prev_vj_config.2), + departure_time: Some(prev_vj_config.3), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -227,8 +231,10 @@ mod tests { let next_vj_config_time_1 = StopTime { stop_point_idx: sp_idxs[next_vj_config.1], sequence: 1, - arrival_time: next_vj_config.2, - departure_time: next_vj_config.3, + arrival_time: Some(next_vj_config.2), + departure_time: Some(next_vj_config.3), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -240,8 +246,10 @@ mod tests { let next_vj_config_time_2 = StopTime { stop_point_idx: sp_idxs[3], sequence: 1, - arrival_time: next_vj_config.2 + Time::new(1, 0, 0), - departure_time: next_vj_config.3 + Time::new(1, 0, 0), + arrival_time: Some(next_vj_config.2 + Time::new(1, 0, 0)), + departure_time: Some(next_vj_config.3 + Time::new(1, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -451,8 +459,10 @@ mod tests { vj_mut.stop_times.push(StopTime { stop_point_idx: sp4_idx, sequence: 2, - arrival_time: Time::new(11, 30, 0), - departure_time: Time::new(11, 30, 0), + arrival_time: Some(Time::new(11, 30, 0)), + departure_time: Some(Time::new(11, 30, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 3, diff --git a/src/gtfs/read.rs b/src/gtfs/read.rs index 327e1b710..ce04b7c51 100644 --- a/src/gtfs/read.rs +++ b/src/gtfs/read.rs @@ -477,8 +477,10 @@ where .push(objects::StopTime { stop_point_idx, sequence: stop_time.stop_sequence, - arrival_time: st_values.arrival_time, - departure_time: st_values.departure_time, + arrival_time: Some(st_values.arrival_time), + departure_time: Some(st_values.departure_time), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type, @@ -1065,6 +1067,7 @@ fn make_routes(gtfs_trips: &[Trip], map_line_routes: &MapLineRoutes<'_>) -> Vec< } let has_one_direction = route_directions.len() <= 1; + for d in route_directions { let mut codes = KeysValues::default(); codes.insert(("source".to_string(), r.id.clone())); @@ -2415,8 +2418,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:01").unwrap(), sequence: 1, - arrival_time: Time::new(6, 0, 0), - departure_time: Time::new(6, 0, 0), + arrival_time: Some(Time::new(6, 0, 0)), + departure_time: Some(Time::new(6, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2427,8 +2432,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:02").unwrap(), sequence: 2, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, @@ -2439,8 +2446,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:03").unwrap(), sequence: 3, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, @@ -2507,8 +2516,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:01").unwrap(), sequence: 1, - arrival_time: Time::new(6, 0, 0), - departure_time: Time::new(6, 0, 0), + arrival_time: Some(Time::new(6, 0, 0)), + departure_time: Some(Time::new(6, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2519,8 +2530,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:02").unwrap(), sequence: 2, - arrival_time: Time::new(6, 11, 0), - departure_time: Time::new(6, 11, 0), + arrival_time: Some(Time::new(6, 11, 0)), + departure_time: Some(Time::new(6, 11, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2531,8 +2544,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:03").unwrap(), sequence: 3, - arrival_time: Time::new(6, 22, 0), - departure_time: Time::new(6, 22, 0), + arrival_time: Some(Time::new(6, 22, 0)), + departure_time: Some(Time::new(6, 22, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2590,8 +2605,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:01").unwrap(), sequence: 1, - arrival_time: Time::new(6, 0, 0), - departure_time: Time::new(6, 0, 0), + arrival_time: Some(Time::new(6, 0, 0)), + departure_time: Some(Time::new(6, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2602,8 +2619,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:02").unwrap(), sequence: 2, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, @@ -3021,7 +3040,7 @@ mod tests { collections.vehicle_journeys.into_vec()[0] .stop_times .iter() - .map(|st| (st.arrival_time, st.departure_time)) + .map(|st| (st.arrival_time.unwrap(), st.departure_time.unwrap())) .collect::>() ); }); @@ -3213,8 +3232,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:01").unwrap(), sequence: 1, - arrival_time: Time::new(6, 0, 0), - departure_time: Time::new(6, 0, 0), + arrival_time: Some(Time::new(6, 0, 0)), + departure_time: Some(Time::new(6, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -3225,8 +3246,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:02").unwrap(), sequence: 2, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, @@ -3237,8 +3260,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp:03").unwrap(), sequence: 3, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, diff --git a/src/gtfs/write.rs b/src/gtfs/write.rs index 6c5a27e4d..cdce63a34 100644 --- a/src/gtfs/write.rs +++ b/src/gtfs/write.rs @@ -480,8 +480,8 @@ pub fn write_stop_times( stop_id: stop_points[st.stop_point_idx].id.clone(), trip_id: vj.id.clone(), stop_sequence: st.sequence, - arrival_time: Some(st.arrival_time), - departure_time: Some(st.departure_time), + arrival_time: st.arrival_time, + departure_time: st.departure_time, pickup_type: st.pickup_type, drop_off_type: st.drop_off_type, local_zone_id: st.local_zone_id, @@ -953,8 +953,10 @@ mod tests { objects::StopTime { stop_point_idx: collections.stop_points.get_idx("OIF:SP:36:2085").unwrap(), sequence: 0, - arrival_time: objects::Time::new(14, 40, 0), - departure_time: objects::Time::new(14, 40, 0), + arrival_time: Some(objects::Time::new(14, 40, 0)), + departure_time: Some(objects::Time::new(14, 40, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -965,8 +967,10 @@ mod tests { objects::StopTime { stop_point_idx: collections.stop_points.get_idx("OIF:SP:36:2127").unwrap(), sequence: 1, - arrival_time: objects::Time::new(14, 42, 0), - departure_time: objects::Time::new(14, 42, 0), + arrival_time: Some(objects::Time::new(14, 42, 0)), + departure_time: Some(objects::Time::new(14, 42, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -996,8 +1000,10 @@ mod tests { objects::StopTime { stop_point_idx: collections.stop_points.get_idx("OIF:SP:36:2085").unwrap(), sequence: 0, - arrival_time: objects::Time::new(14, 40, 0), - departure_time: objects::Time::new(14, 40, 0), + arrival_time: Some(objects::Time::new(14, 40, 0)), + departure_time: Some(objects::Time::new(14, 40, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -1008,8 +1014,10 @@ mod tests { objects::StopTime { stop_point_idx: collections.stop_points.get_idx("OIF:SP:36:2127").unwrap(), sequence: 1, - arrival_time: objects::Time::new(14, 42, 0), - departure_time: objects::Time::new(14, 42, 0), + arrival_time: Some(objects::Time::new(14, 42, 0)), + departure_time: Some(objects::Time::new(14, 42, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -1224,8 +1232,10 @@ mod tests { StopTime { stop_point_idx: stop_points.get_idx("sp:01").unwrap(), sequence: 1, - arrival_time: Time::new(6, 0, 0), - departure_time: Time::new(6, 0, 0), + arrival_time: Some(Time::new(6, 0, 0)), + departure_time: Some(Time::new(6, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -1236,8 +1246,10 @@ mod tests { StopTime { stop_point_idx: stop_points.get_idx("sp:01").unwrap(), sequence: 2, - arrival_time: Time::new(6, 6, 27), - departure_time: Time::new(6, 6, 27), + arrival_time: Some(Time::new(6, 6, 27)), + departure_time: Some(Time::new(6, 6, 27)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 2, diff --git a/src/model.rs b/src/model.rs index 65732e045..05dea22c2 100644 --- a/src/model.rs +++ b/src/model.rs @@ -1351,7 +1351,20 @@ impl Collections { ); continue; }; - let mut arrival_time_delta = st.arrival_time; + + if corresponding_vj.stop_times.iter().any(|st| { + st.start_pickup_drop_off_window.is_some() || st.end_pickup_drop_off_window.is_some() + }) { + warn!( + "frequency mapped to trip {:?} with drop_off_window stop_times not supported", + frequency.vehicle_journey_id + ); + continue; + } + + let mut arrival_time_delta = st + .arrival_time + .expect("`stop_time.arrival_time` should not be empty"); while start_time < frequency.end_time { trip_id_sequence @@ -1393,17 +1406,27 @@ impl Collections { let stop_times: Vec = corresponding_vj .stop_times .iter() - .map(|stop_time| StopTime { - stop_point_idx: stop_time.stop_point_idx, - sequence: stop_time.sequence, - arrival_time: stop_time.arrival_time + start_time - arrival_time_delta, - departure_time: stop_time.departure_time + start_time - arrival_time_delta, - boarding_duration: stop_time.boarding_duration, - alighting_duration: stop_time.alighting_duration, - pickup_type: stop_time.pickup_type, - drop_off_type: stop_time.drop_off_type, - local_zone_id: stop_time.local_zone_id, - precision: stop_time.precision.clone(), + .map(|stop_time| { + let arrival_time = stop_time + .arrival_time + .map(|at| at + start_time - arrival_time_delta); + let departure_time = stop_time + .departure_time + .map(|dt| dt + start_time - arrival_time_delta); + StopTime { + stop_point_idx: stop_time.stop_point_idx, + sequence: stop_time.sequence, + arrival_time, + departure_time, + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, + boarding_duration: stop_time.boarding_duration, + alighting_duration: stop_time.alighting_duration, + pickup_type: stop_time.pickup_type, + drop_off_type: stop_time.drop_off_type, + local_zone_id: stop_time.local_zone_id, + precision: stop_time.precision.clone(), + } }) .collect(); start_time = start_time + Time::new(0, 0, frequency.headway_secs); @@ -1727,8 +1750,10 @@ mod tests { let stop_time = StopTime { stop_point_idx: collections.stop_points.get_idx("stop_point_id").unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2067,8 +2092,10 @@ mod tests { let stop_time_at = |stop_point_id: &str| StopTime { stop_point_idx: collections.stop_points.get_idx(stop_point_id).unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -2537,8 +2564,10 @@ mod tests { StopTime { stop_point_idx: stop_points.get_idx(stop_point_id).unwrap(), sequence: 1, - arrival_time, - departure_time, + arrival_time: Some(arrival_time), + departure_time: Some(departure_time), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, diff --git a/src/model_builder.rs b/src/model_builder.rs index 1847d9c9f..fdbcb09cd 100644 --- a/src/model_builder.rs +++ b/src/model_builder.rs @@ -735,8 +735,10 @@ impl<'a> VehicleJourneyBuilder<'a> { let mut stop_time = StopTime { stop_point_idx, sequence, - arrival_time: arrival.as_time(), - departure_time: departure.as_time(), + arrival_time: Some(arrival.as_time()), + departure_time: Some(departure.as_time()), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0u16, alighting_duration: 0u16, pickup_type, diff --git a/src/netex_france/offer.rs b/src/netex_france/offer.rs index a73cc060b..c59252d29 100644 --- a/src/netex_france/offer.rs +++ b/src/netex_france/offer.rs @@ -415,17 +415,23 @@ impl<'a> OfferExporter<'a> { } fn export_timetabled_passing_time(stop_time: &'a StopTime) -> Element { - let arrival_day_offset = stop_time.arrival_time.hours() / 24; + let arrival_time = stop_time + .arrival_time + .expect("`stop_time.arrival_time` should not be empty"); + let departure_time = stop_time + .departure_time + .expect("`stop_time.departure_time` should not be empty"); + let arrival_day_offset = arrival_time.hours() / 24; let arrival_time = Time::new( - stop_time.arrival_time.hours() % 24, - stop_time.arrival_time.minutes(), - stop_time.arrival_time.seconds(), + arrival_time.hours() % 24, + arrival_time.minutes(), + arrival_time.seconds(), ); - let departure_day_offset = stop_time.departure_time.hours() / 24; + let departure_day_offset = departure_time.hours() / 24; let departure_time = Time::new( - stop_time.departure_time.hours() % 24, - stop_time.departure_time.minutes(), - stop_time.departure_time.seconds(), + departure_time.hours() % 24, + departure_time.minutes(), + departure_time.seconds(), ); Element::builder(ObjectType::TimetabledPassingTime.to_string()) .append(Self::generate_arrival_time(arrival_time)) @@ -804,8 +810,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_1").unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -816,8 +824,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_2").unwrap(), sequence: 1, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 1, @@ -847,8 +857,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_1").unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -859,8 +871,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_2").unwrap(), sequence: 1, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 1, @@ -901,8 +915,10 @@ mod tests { stop_times: vec![StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_1").unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, @@ -948,8 +964,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_1").unwrap(), sequence: 0, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, // This pickup type is different from 'vj_id_1' @@ -961,8 +979,10 @@ mod tests { StopTime { stop_point_idx: collections.stop_points.get_idx("sp_id_2").unwrap(), sequence: 1, - arrival_time: Time::new(0, 0, 0), - departure_time: Time::new(0, 0, 0), + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(Time::new(0, 0, 0)), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 1, diff --git a/src/netex_france/route_points.rs b/src/netex_france/route_points.rs index 3474bbc94..3a2eef0ac 100644 --- a/src/netex_france/route_points.rs +++ b/src/netex_france/route_points.rs @@ -110,8 +110,10 @@ mod tests { StopTime { stop_point_idx, sequence, - arrival_time: Time::new(0, 0, 0), - departure_time, + arrival_time: Some(Time::new(0, 0, 0)), + departure_time: Some(departure_time), + start_pickup_drop_off_window: None, + end_pickup_drop_off_window: None, boarding_duration: 0, alighting_duration: 0, pickup_type: 0, diff --git a/src/ntfs/mod.rs b/src/ntfs/mod.rs index 98804fc65..5d86312c1 100644 --- a/src/ntfs/mod.rs +++ b/src/ntfs/mod.rs @@ -41,8 +41,10 @@ struct StopTime { stop_id: String, trip_id: String, stop_sequence: u32, - arrival_time: Time, - departure_time: Time, + arrival_time: Option