Added an obscene amount of debug logging.
This commit is contained in:
@@ -2,6 +2,8 @@ mod loader;
|
||||
mod utils;
|
||||
pub mod structs;
|
||||
use chrono::{DateTime, Local};
|
||||
use log::{debug, info, warn};
|
||||
use sdl3::libc::stpncpy;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
fs::File,
|
||||
@@ -45,6 +47,7 @@ impl Gtfs {
|
||||
active_service_ids.insert(id.to_string());
|
||||
}
|
||||
}
|
||||
debug!("Found {} services active today", active_service_ids.len());
|
||||
|
||||
// Are there any exceptions for the calendars above?
|
||||
for (_calendar_id, exceptions) in self.calendar_dates.iter() {
|
||||
@@ -61,6 +64,7 @@ impl Gtfs {
|
||||
}
|
||||
}
|
||||
}
|
||||
debug!("After exceptions, there are now {} services active", active_service_ids.len());
|
||||
|
||||
// Find the trips happening on these calendars
|
||||
let mut trips: HashMap<&String, &RawTrip> = HashMap::new();
|
||||
@@ -69,6 +73,7 @@ impl Gtfs {
|
||||
trips.insert(&trip.id, trip);
|
||||
}
|
||||
}
|
||||
debug!("Found {} trips", trips.len());
|
||||
|
||||
// Finally, find the arrivals for the active trips on the chosen stops
|
||||
let mut arrivals: Vec<Arrival> = Vec::new();
|
||||
@@ -76,6 +81,7 @@ impl Gtfs {
|
||||
for (_id, stop_time) in self.stop_times.iter() {
|
||||
if trips.contains_key(&stop_time.trip_id) {
|
||||
let stop_timestamp = stop_time.departure_time.or(stop_time.arrival_time).unwrap();
|
||||
debug!("Stop timestamp {} current timestamp {}", stop_timestamp, current_timestamp);
|
||||
if current_timestamp < stop_timestamp.into() {
|
||||
let arrival: Arrival = Arrival {
|
||||
route: self.routes.get(&self.trips.get(&stop_time.trip_id).unwrap().route_id).unwrap(),
|
||||
@@ -86,6 +92,7 @@ impl Gtfs {
|
||||
}
|
||||
}
|
||||
}
|
||||
debug!("Found {} arrivals", arrivals.len());
|
||||
|
||||
return Box::from(arrivals);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user