summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstuebinm2022-02-26 10:56:06 +0100
committerstuebinm2022-02-26 10:56:06 +0100
commitc63d08361e056db38b0670b93e2c4af8fcab2b5b (patch)
tree34dbc8b875668141982493bad3cafc5b6424b2a8 /src
parentcd13c85c69cf761b2da84ad91af64d23a3568aa5 (diff)
iceportal: cancelled stops have state null
which … fine, i guess
Diffstat (limited to 'src')
-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()