diff --git a/.pkg b/.pkg index 1e5af07e9..5c59520e6 100644 --- a/.pkg +++ b/.pkg @@ -1,7 +1,7 @@ [nigiri] url=git@github.com:motis-project/nigiri.git branch=master - commit=815bd0c66f7f64aa6edd6011b8e065cc9e1e641b + commit=2cf648ac22315fb6578be3f5d689f4d94e81b457 [cista] url=git@github.com:felixguendling/cista.git branch=master diff --git a/.pkg.lock b/.pkg.lock index f3819d5af..0c9bdacbd 100644 --- a/.pkg.lock +++ b/.pkg.lock @@ -1,4 +1,4 @@ -782561049874253657 +11944721483929486774 cista 847b27100b7e730370b810ce62206a66b0bf2d79 zlib-ng 68ab3e2d80253ec5dc3c83691d9ff70477b32cd3 boost 930f38eb0365ceb7853273e03da4d9e7787abfb9 @@ -26,7 +26,7 @@ opentelemetry-cpp 60770dc9dc63e3543fc87d605b2e88fd53d7a414 pugixml 60175e80e2f5e97e027ac78f7e14c5acc009ce50 unordered_dense b33b037377ca966bbdd9cccc3417e46e88f83bfb wyhash 1e012b57fc2227a9e583a57e2eacb3da99816d99 -nigiri 815bd0c66f7f64aa6edd6011b8e065cc9e1e641b +nigiri 2cf648ac22315fb6578be3f5d689f4d94e81b457 conf f9bf4bd83bf55a2170725707e526cbacc45dcc66 expat 636c9861e8e7c119f3626d1e6c260603ab624516 libosmium 6e6d6b3081cc8bdf25dda89730e25c36eb995516 diff --git a/openapi.yaml b/openapi.yaml index cdd950602..af28ed869 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -359,11 +359,11 @@ paths: schema: type: integer - - name: maxHours + - name: maxTravelTime in: query required: false description: | - The maximum travel time in hours. + The maximum travel time in minutes. If not provided, the routing to uses the value hardcoded in the server which is usually quite high. @@ -371,10 +371,8 @@ paths: optimal (e.g. the least transfers) journeys not being found. If this value is too low to reach the destination at all, it can lead to slow routing performance. - - TODO: pass parameter to nigiri schema: - type: number + type: integer - name: minTransferTime in: query diff --git a/src/endpoints/routing.cc b/src/endpoints/routing.cc index ccfa03abe..0854abbf1 100644 --- a/src/endpoints/routing.cc +++ b/src/endpoints/routing.cc @@ -1,5 +1,7 @@ #include "motis/endpoints/routing.h" +#include + #include "boost/thread/tss.hpp" #include "utl/erase_duplicates.h" @@ -457,6 +459,11 @@ api::plan_response routing::operator()(boost::urls::url_view const& url) const { .max_transfers_ = static_cast( query.maxTransfers_.has_value() ? *query.maxTransfers_ : n::routing::kMaxTransfers), + .max_travel_time_ = query.maxTravelTime_ + .and_then([](std::int64_t const dur) { + return std::optional{n::duration_t{dur}}; + }) + .value_or(kInfinityDuration), .min_connection_count_ = static_cast(query.numItineraries_), .extend_interval_earlier_ = start_time.extend_interval_earlier_, .extend_interval_later_ = start_time.extend_interval_later_,