Skip to content

Commit

Permalink
fix siri structs from erroring on random un-needed keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Techno3d committed Nov 22, 2024
1 parent 3b058e2 commit a62df3a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

./target/release/transit-board &
npm run start &
sleep 5s
firefox --new-tab "localhost:3000"
14 changes: 7 additions & 7 deletions src/siri_structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub struct ServiceDelivery {
#[serde(rename_all = "PascalCase")]
pub struct StopMonitoringDelivery {
pub monitored_stop_visit: Option<Vec<MonitoredStopVisit>>,
pub response_timestamp: String,
pub valid_until: String,
pub response_timestamp: Option<String>,
pub valid_until: Option<String>,
}

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct MonitoredStopVisit {
pub monitored_vehicle_journey: MonitoredVehicleJourney,
pub recorded_at_time: String,
pub recorded_at_time: Option<String>,
}

#[derive(Serialize, Deserialize)]
Expand All @@ -59,8 +59,8 @@ pub struct MonitoredVehicleJourney {
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct FramedVehicleJourneyRef {
pub data_frame_ref: String,
pub dated_vehicle_journey_ref: String,
pub data_frame_ref: Option<String>,
pub dated_vehicle_journey_ref: Option<String>,
}

#[derive(Serialize, Deserialize)]
Expand Down Expand Up @@ -105,8 +105,8 @@ pub struct Situations {
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PtSituationElement {
pub publication_window: PublicationWindow,
pub severity: String,
pub publication_window: Option<PublicationWindow>,
pub severity: Option<String>,
pub summary: Vec<String>,
pub description: Vec<String>,
pub situation_number: String,
Expand Down
1 change: 1 addition & 0 deletions src/subway_stop_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl SubwayStopHandler {
})
.time();
let duration = ((arrival_time - current_time).max(0) / 60) as i32;
//println!("{}, {}, {}", arrival_time, current_time, arrival_time-current_time);

// Route
let route_id = trip_update
Expand Down

0 comments on commit a62df3a

Please sign in to comment.