add next stop
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 5m35s

This commit is contained in:
Nicholas Orlowsky 2025-10-08 07:40:36 -04:00
parent 8bad3eb74e
commit 8ab3ed331f
No known key found for this signature in database
GPG key ID: A9F3BA4C0AA7A70B
3 changed files with 12 additions and 2 deletions

View file

@ -95,7 +95,13 @@ impl TripTrackingService {
TripTracking::Tracked( TripTracking::Tracked(
LiveTrip { LiveTrip {
delay: live_track.delay, delay: live_track.delay,
next_stop_id: live_track.next_stop_id, next_stop_id: match live_track.next_stop_id {
Some(x) => match x.parse() {
Ok(y) => Some(y),
Err(_) => None
},
None => None
},
timestamp: live_track.timestamp, timestamp: live_track.timestamp,
vehicle_id: live_track.vehicle_id vehicle_id: live_track.vehicle_id
} }

View file

@ -148,7 +148,11 @@ document.addEventListener("DOMContentLoaded", () => {
{% let live_o = timetable.tracking_data[loop.index0] %} {% let live_o = timetable.tracking_data[loop.index0] %}
{% if let Tracked(live) = live_o %} {% if let Tracked(live) = live_o %}
{% let time = (t + (live.delay * 60.0) as i64) %} {% let time = (t + (live.delay * 60.0) as i64) %}
{% if live.next_stop_id == Some(*row.stop_id) %}
<td style="background-color: #00bb00">
{% else %}
<td style="background-color: #003300"> <td style="background-color: #003300">
{% endif %}
<span style="color: #22bb22"> {{ time | format_time }} </span> <span style="color: #22bb22"> {{ time | format_time }} </span>
</td> </td>
{% elif let TripTracking::Cancelled = live_o %} {% elif let TripTracking::Cancelled = live_o %}

View file

@ -31,7 +31,7 @@ pub enum TripTracking {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LiveTrip { pub struct LiveTrip {
pub delay: f64, pub delay: f64,
pub next_stop_id: Option<String>, pub next_stop_id: Option<i64>,
pub timestamp: i64, pub timestamp: i64,
pub vehicle_id: Option<String> pub vehicle_id: Option<String>
} }