From c63d08361e056db38b0670b93e2c4af8fcab2b5b Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 26 Feb 2022 10:56:06 +0100 Subject: iceportal: cancelled stops have state null which … fine, i guess --- src/onboard/iceportal.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/onboard') diff --git a/src/onboard/iceportal.rs b/src/onboard/iceportal.rs index 04ec291..bc97261 100644 --- a/src/onboard/iceportal.rs +++ b/src/onboard/iceportal.rs @@ -41,7 +41,7 @@ pub struct Stop { #[serde(rename_all = "camelCase")] struct StopInfo { distance_from_start: u64, - position_status: String // one of "departed", "future", ... ? + position_status: Option // one of "departed", "future", ... (?); null if cancelled } #[derive(Deserialize, Debug)] @@ -86,6 +86,7 @@ impl OnBoardInfo for TripInfo { .stops .iter() .rev() + .filter(|stop| stop.info.position_status.is_some()) .map(|stop| (stop.info.distance_from_start, stop)) .filter(|(dist, _)| dist <= ¤t_pos) .next() -- cgit v1.2.3