Skip to content

Commit

Permalink
consideration of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
patochectp committed Oct 8, 2019
1 parent 562b630 commit 76c2dae
Show file tree
Hide file tree
Showing 17 changed files with 329 additions and 404 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 = ["Kisio Digital <[email protected]>", "Guillaume Pinot <[email protected]>"]
name = "transit_model"
version = "0.9.0"
version = "0.8.0"
license = "AGPL-3.0"
description = "Transit data management"
repository = "https://github.com/CanalTP/transit_model"
Expand Down
2 changes: 1 addition & 1 deletion src/add_prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ impl AddPrefix for Collections {
self.vehicle_journeys.add_prefix(&prefix);
self.stop_areas.add_prefix(&prefix);
self.stop_points.add_prefix(&prefix);
self.stop_locations.add_prefix(&prefix);
self.calendars.add_prefix(&prefix);
self.companies.add_prefix(&prefix);
self.comments.add_prefix(&prefix);
Expand All @@ -78,7 +79,6 @@ impl AddPrefix for Collections {
self.ticket_use_restrictions.add_prefix(&prefix);
self.pathways.add_prefix(&prefix);
self.levels.add_prefix(&prefix);
self.stop_locations.add_prefix(&prefix);
}
}

Expand Down
40 changes: 19 additions & 21 deletions src/gtfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,26 @@ enum StopLocationType {
}

impl Into<StopType> for StopLocationType {
fn into(self) -> objects::StopType {
let stop_type = match self {
StopLocationType::StopPoint => objects::StopType::Point,
StopLocationType::StopArea => objects::StopType::Zone,
StopLocationType::StopEntrance => objects::StopType::StopEntrance,
StopLocationType::GenericNode => objects::StopType::GenericNode,
StopLocationType::BoardingArea => objects::StopType::BoardingArea,
};
stop_type
fn into(self) -> StopType {
match self {
StopLocationType::StopPoint => StopType::Point,
StopLocationType::StopArea => StopType::Zone,
StopLocationType::StopEntrance => StopType::StopEntrance,
StopLocationType::GenericNode => StopType::GenericNode,
StopLocationType::BoardingArea => StopType::BoardingArea,
}
}
}

impl From<StopType> for StopLocationType {
fn from(stop_type: StopType) -> StopLocationType {
let stop_location_type = match stop_type {
objects::StopType::Point => StopLocationType::StopPoint,
objects::StopType::Zone => StopLocationType::StopArea,
objects::StopType::StopEntrance => StopLocationType::StopEntrance,
objects::StopType::GenericNode => StopLocationType::GenericNode,
objects::StopType::BoardingArea => StopLocationType::BoardingArea,
};
stop_location_type
match stop_type {
StopType::Point => StopLocationType::StopPoint,
StopType::Zone => StopLocationType::StopArea,
StopType::StopEntrance => StopLocationType::StopEntrance,
StopType::GenericNode => StopLocationType::GenericNode,
StopType::BoardingArea => StopLocationType::BoardingArea,
}
}
}

Expand All @@ -122,7 +120,7 @@ struct Stop {
id: String,
#[serde(rename = "stop_code")]
code: Option<String>,
#[serde(rename = "stop_name")] //Conditionally Required
#[serde(rename = "stop_name")]
name: String,
#[serde(
default,
Expand All @@ -141,7 +139,7 @@ struct Stop {
#[serde(default, deserialize_with = "de_with_empty_default")]
location_type: StopLocationType,
#[serde(default, deserialize_with = "de_option_without_slashes")]
parent_station: Option<String>, //Conditionally Required
parent_station: Option<String>,
#[serde(rename = "stop_timezone")]
timezone: Option<String>,
level_id: Option<String>,
Expand Down Expand Up @@ -285,7 +283,7 @@ where
collections.networks = networks;
collections.companies = companies;
let (stop_areas, stop_points, stop_locations) =
read::manage_stops(file_handler, &mut comments, &mut equipments)?;
read::read_stops(file_handler, &mut comments, &mut equipments)?;
collections.transfers = read::read_transfers(file_handler, &stop_points)?;
collections.stop_areas = stop_areas;
collections.stop_points = stop_points;
Expand All @@ -298,7 +296,7 @@ where
collections.comments = comments;
read::manage_stop_times(&mut collections, file_handler)?;
read::manage_frequencies(&mut collections, file_handler)?;
collections.pathways = read::read_pathways(file_handler)?;
collections.pathways = read::read_pathways(&mut collections, file_handler)?;
collections.levels = read_utils::read_opt_collection(file_handler, "levels.txt")?;
collections.sanitize()?;

Expand Down
Loading

0 comments on commit 76c2dae

Please sign in to comment.