Skip to content

Commit

Permalink
Stockholm is back
Browse files Browse the repository at this point in the history
  • Loading branch information
npanuhin committed Dec 9, 2024
1 parent dc01d48 commit fb6ff02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions models/src/transportSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ TransportSystem::TransportSystem(const QDir &sourceDir) {
stop.transfers = &*transfers.end(); // `transfers` has its size finalized
}
if (stop.routes == nullptr) {
throw runtime_error("Stop is not assigned to any route: " + stop.id.toStdString());
// stop.routes = &*stopRoutes.end();
// throw runtime_error("Stop is not assigned to any route: " + stop.id.toStdString());
stop.routes = &*stopRoutes.end(); // `stopRoutes` has its size finalized
}
}
cout << "Building stops index..." << endl;
Expand Down Expand Up @@ -185,7 +185,7 @@ bool TransportSystem::isValid() const {
});
bool stopsAreValid = ranges::all_of(stops.begin(), stops.end(), [&](const Stop &stop) {
return stop.transfers >= &*transfers.begin() && stop.transfers <= &*transfers.end() &&
stop.routes >= &*stopRoutes.begin() && stop.routes < &*stopRoutes.end();
stop.routes >= &*stopRoutes.begin() && stop.routes <= &*stopRoutes.end();
});
bool transfersAreValid = ranges::all_of(transfers.begin(), transfers.end(), [&](const Transfer &transfer) {
return transfer.start >= &*stops.begin() && transfer.start < &*stops.end() &&
Expand Down
2 changes: 1 addition & 1 deletion scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
('hamburg', date(2020, 3, 20)), # GTFS data date: 20 March 2020
('milan', date(2021, 9, 8)), # GTFS data date: 8 September 2021
('paris', date(2021, 3, 25)), # GTFS data date: 25 March 2021
# ('stockholm', date(2020, 2, 24)), # GTFS data date: 24 February 2020
('stockholm', date(2020, 2, 24)), # GTFS data date: 24 February 2020
]

# ====================================================== Settings ======================================================
Expand Down
12 changes: 6 additions & 6 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ TEST_CASE("Pathfinder test") {
REQUIRE(milan.isValid());
}

// SUBCASE("Stockholm") {
// TransportSystem stockholm(QDir(PROJECT_ROOT_PATH "/data/gtfs_stockholm"));
// QDate stockholmDate(2020, 03, 24);
//
// REQUIRE(stockholm.isValid());
// }
SUBCASE("Stockholm") {
TransportSystem stockholm(QDir(PROJECT_ROOT_PATH "/data/gtfs_stockholm"));
QDate stockholmDate(2020, 03, 24);

REQUIRE(stockholm.isValid());
}
}

TEST_CASE("Substring find test") {
Expand Down

0 comments on commit fb6ff02

Please sign in to comment.