-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from datanel/export_gtfs_mode_route_shortname
[feature] ntfs2gtfs: add flag mode_in_route_short_name
- Loading branch information
Showing
43 changed files
with
102 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.30.0" | ||
version = "0.30.1" | ||
license = "AGPL-3.0-only" | ||
description = "Transit data management" | ||
repository = "https://github.com/CanalTP/transit_model" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "ntfs2gtfs" | ||
version = "1.0.0" | ||
version = "1.1.0" | ||
authors = ["Kisio Digital <[email protected]>"] | ||
license = "AGPL-3.0-only" | ||
description = "Binary to convert Transit data from NTFS format to GTFS" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 Kisio Digital and/or its affiliates. | ||
// | ||
// This program is free software: you can redistribute it and/or | ||
// modify it under the terms of the GNU General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but | ||
// WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see | ||
// <http://www.gnu.org/licenses/>. | ||
|
||
use transit_model::{Model, Result}; | ||
|
||
pub fn add_mode_to_line_code(model: Model) -> Result<Model> { | ||
let mut collections = model.into_collections(); | ||
let indexes: Vec<_> = collections.lines.iter().map(|(idx, _)| idx).collect(); | ||
for idx in indexes { | ||
let mut line = collections.lines.index_mut(idx); | ||
let mode = collections.commercial_modes.get(&line.commercial_mode_id); | ||
let code = match (line.code.clone(), mode) { | ||
(Some(c), Some(m)) => Some(m.name.clone() + " " + &c), | ||
(Some(c), None) => Some(c), | ||
(None, Some(m)) => Some(m.name.clone()), | ||
_ => None, | ||
}; | ||
line.code = code; | ||
} | ||
|
||
Ok(Model::new(collections)?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
line_id,line_name,network_id,commercial_mode_id,geometry_id,line_code | ||
line:1,Metro 1,network:kept,Metro,,1 | ||
line:2,Metro 2,network:removed,Metro,, |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
tests/fixtures/ntfs2gtfs/output/routes.txt → ntfs2gtfs/tests/fixtures/output/routes.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color,route_sort_order | ||
line:1,network:kept,,Metro 1,,1,,,, | ||
line:1,network:kept,1,Metro 1,,1,,,, |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
ntfs2gtfs/tests/fixtures/output_route_shortname_with_mode/routes.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color,route_sort_order | ||
line:1,network:kept,Metro 1,Metro 1,,1,,,, |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.