Skip to content

Commit

Permalink
Merge pull request #851 from hove-io/sanitize_admin_stations
Browse files Browse the repository at this point in the history
feat: remove admin station with invalid stop_id
  • Loading branch information
ArnaudOggy authored May 31, 2022
2 parents 7dbcea1 + 7fa8ac6 commit 65f8bf3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Hove <[email protected]>", "Guillaume Pinot <[email protected]>"]
name = "transit_model"
version = "0.49.1"
version = "0.50.0"
license = "AGPL-3.0-only"
description = "Transit data management"
repository = "https://github.com/hove-io/transit_model"
Expand Down
2 changes: 2 additions & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ impl Collections {
self.calendars.retain(|c| calendars_used.contains(&c.id));
self.addresses
.retain(|address| addresses_used.contains(&address.id));
self.admin_stations
.retain(|admin_station| stop_area_ids_used.contains(&admin_station.stop_id));

self.frequencies = dedup_collection(&mut self.frequencies);
self.transfers = dedup_collection(&mut self.transfers);
Expand Down
4 changes: 1 addition & 3 deletions src/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
Result,
};
use std::collections::HashMap;
use tracing::{info, warn};
use tracing::info;
use typed_index_collection::{Collection, CollectionWithId, Idx};

type TransferMap = HashMap<(Idx<StopPoint>, Idx<StopPoint>), Transfer>;
Expand Down Expand Up @@ -59,13 +59,11 @@ fn generate_transfers_from_sp(
let sq_max_distance = max_distance * max_distance;
for (idx1, sp1) in model.stop_points.iter() {
if sp1.coord == Coord::default() {
warn!("Stop Point {} geolocation is (0, 0), no transfer from this StopPoint will be generated.", sp1.id);
continue;
}
let approx = sp1.coord.approx();
for (idx2, sp2) in model.stop_points.iter() {
if sp2.coord == Coord::default() {
warn!("Stop Point {} geolocation is (0, 0), no transfer to this StopPoint will be generated.", sp2.id);
continue;
}
if transfers_map.contains_key(&(idx1, idx2)) {
Expand Down

0 comments on commit 65f8bf3

Please sign in to comment.