Skip to content

Commit

Permalink
bugfix filter_stop_times: catch NAs for missing max_arrival_time
Browse files Browse the repository at this point in the history
  • Loading branch information
polettif committed Dec 20, 2024
1 parent a09a52d commit ad5e49d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/travel_times.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ filter_stop_times = function(gtfs_obj,
min_departure_time <- hhmmss_to_seconds(min_departure_time)
}
if(missing(max_arrival_time)) {
max_arrival_time <- max(gtfs_obj$stop_times$arrival_time)+1
max_arrival_time <- max(gtfs_obj$stop_times$arrival_time, na.rm = TRUE)+1
} else if(is.character(max_arrival_time)) {
max_arrival_time <- hhmmss_to_seconds(max_arrival_time)
}
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-travel_times.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ test_that("travel_times with filtered feed", {
})

test_that("time_range param", {
expect_is(filter_feed_by_date(gtfs_duke, "2019-10-01"), "tidygtfs")
st = filter_feed_by_date(gtfs_routing, "2018-10-01")

tt1 = travel_times(st, stop_name = "One", time_range = c("07:09:00", "07:59:00"))
Expand Down

0 comments on commit ad5e49d

Please sign in to comment.