Some extra debugging output and cleanups
This commit is contained in:
+4
-2
@@ -7,7 +7,7 @@ pub mod structs;
|
|||||||
use chrono::{DateTime, Local, Timelike};
|
use chrono::{DateTime, Local, Timelike};
|
||||||
use log::{debug, trace, warn};
|
use log::{debug, trace, warn};
|
||||||
use std::{collections::{HashMap, HashSet}, fs::File };
|
use std::{collections::{HashMap, HashSet}, fs::File };
|
||||||
use gtfs_structures::{ContinuousPickupDropOff::ArrangeByPhone, Exception, RawTrip};
|
use gtfs_structures::{Exception, RawTrip};
|
||||||
use crate::gtfs::{loader::load_gtfs, structs::{Arrival, Gtfs, Preferences, Error}};
|
use crate::gtfs::{loader::load_gtfs, structs::{Arrival, Gtfs, Preferences, Error}};
|
||||||
|
|
||||||
|
|
||||||
@@ -18,12 +18,14 @@ impl Gtfs<'_> {
|
|||||||
let target_date = naive_target.date();
|
let target_date = naive_target.date();
|
||||||
|
|
||||||
// Find which calendars apply
|
// Find which calendars apply
|
||||||
|
debug!("Looking for calendars that apply to date {:#?}", target_date);
|
||||||
let mut active_service_ids: HashSet<String> = HashSet::new();
|
let mut active_service_ids: HashSet<String> = HashSet::new();
|
||||||
for (id, calendar) in self.calendar.iter() {
|
for (id, calendar) in self.calendar.iter() {
|
||||||
if calendar.valid_weekday(target_date)
|
if calendar.valid_weekday(target_date)
|
||||||
&& calendar.start_date <= target_date
|
&& calendar.start_date <= target_date
|
||||||
&& calendar.end_date > target_date {
|
&& calendar.end_date > target_date {
|
||||||
active_service_ids.insert(id.to_string());
|
active_service_ids.insert(id.to_string());
|
||||||
|
debug!("Matched calendar: {:#?}", calendar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug!("Found {} services active today", active_service_ids.len());
|
debug!("Found {} services active today", active_service_ids.len());
|
||||||
@@ -43,7 +45,7 @@ impl Gtfs<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug!("After exceptions, there are now {} services active", active_service_ids.len());
|
debug!("After exceptions, there are now {} services active: {:#?}", active_service_ids.len(), active_service_ids);
|
||||||
|
|
||||||
// Find the trips happening on these calendars
|
// Find the trips happening on these calendars
|
||||||
let mut trips: HashMap<&String, &RawTrip> = HashMap::new();
|
let mut trips: HashMap<&String, &RawTrip> = HashMap::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user