Skip to content

Commit

Permalink
count implicit traveltime transfers from same stop_id; fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Aug 16, 2022
1 parent 48eb2df commit 69e5406
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: gtfsrouter
Title: Routing with GTFS (General Transit Feed Specification) Data
Version: 0.0.5.090
Version: 0.0.5.091
Authors@R: c(
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre")),
person("Marcin", "Stepniak", , "[email protected]", role = "aut",
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"codeRepository": "https://github.com/ATFutures/gtfs-router",
"issueTracker": "https://github.com/ATFutures/gtfs-router/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.5.090",
"version": "0.0.5.091",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
12 changes: 12 additions & 0 deletions src/traveltimes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ bool iso::fill_one_iso (
Iso &iso) {

bool fill_vals = false, is_end_stn = false, same_trip = false;
bool is_transfer = false;
// is_transfer is used to increment "implicit" transfers to different
// services from same stop_id, which do not otherwise appear as transfers.

int prev_trip = -1L; // int to allow -1L flag
int ntransfers = INFINITE_INT;
int latest_initial = -1L;
Expand Down Expand Up @@ -192,6 +196,7 @@ bool iso::fill_one_iso (
latest_initial = st.initial_depart;
prev_trip = static_cast <int> (st.trip);
ntransfers = st.ntransfers;
is_transfer = st.is_transfer;
}
}

Expand Down Expand Up @@ -246,6 +251,13 @@ bool iso::fill_one_iso (
iso.earliest_departure [arrival_station] = departure_time;
} else
{
if (!same_trip && !is_transfer)
{
// connections flagged with 'is_transfer' have already had transfers
// incremented; this increments only "implicit" transfers from same
// stop_id to different service (trip_id)
ntransfers++;
}
iso.connections [arrival_station].convec [s].ntransfers = ntransfers;
iso.connections [arrival_station].convec [s].initial_depart = latest_initial;
}
Expand Down

0 comments on commit 69e5406

Please sign in to comment.