Skip to content

Commit

Permalink
Change unit to minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKutzner committed Nov 21, 2024
1 parent 7b3eb2d commit 707e019
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ paths:
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.
Expand All @@ -372,7 +372,7 @@ paths:
If this value is too low to reach the destination at all,
it can lead to slow routing performance.
schema:
type: number
type: integer

- name: minTransferTime
in: query
Expand Down
6 changes: 3 additions & 3 deletions src/endpoints/routing.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "motis/endpoints/routing.h"

#include <cmath>
#include <algorithm>

#include "boost/thread/tss.hpp"

Expand Down Expand Up @@ -296,11 +296,11 @@ stats_map_t join(auto&&... maps) {
// Get cutoff to remove journeys with slower or equal duration
std::optional<n::duration_t> calculate_search_cutoff_time(
n::duration_t const fastest_direct,
std::optional<double> const& max_travel_time) {
std::optional<int> const& max_travel_time) {
if (max_travel_time.has_value()) {
// Add +1 to keep journeys with equal duration
auto const max_travel_duration =
n::duration_t{std::lround(60 * *max_travel_time) + 1};
n::duration_t{*max_travel_time + 1};
return fastest_direct == kInfinityDuration
? max_travel_duration
: std::min(fastest_direct, max_travel_duration);
Expand Down

0 comments on commit 707e019

Please sign in to comment.