summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/onboard/iceportal.rs3
1 files changed, 2 insertions, 1 deletions
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<String> // 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 <= &current_pos)
.next()