Skip to content

Commit

Permalink
fix nocov ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Oct 22, 2024
1 parent fa0d163 commit 57efbcb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
8 changes: 4 additions & 4 deletions R/latest_flights_date.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
#' latest_date <- latest_flights_date()
#'
#'}}
latest_flights_date <- function(){
latest_flights_date <- function(){ # nocov start

# get all dates available
all_dates <- get_flight_dates_available()

# find latest date
latest_date <- max(all_dates)
return(latest_date)
}
} # nocov end



Expand All @@ -34,12 +34,12 @@ latest_flights_date <- function(){
#' latest_date <- latest_airfares_date()
#'
#'}}
latest_airfares_date <- function(dom=TRUE){
latest_airfares_date <- function(dom=TRUE){ # nocov start

# get all dates available
all_dates <- get_airfares_dates_available(dom)

# find latest date
latest_date <- max(all_dates)
return(latest_date)
}
} # nocov end
2 changes: 1 addition & 1 deletion R/utils_aircrafts.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ download_aircrafts_data <- function(file_url = parent.frame()$file_url,
dest_file = temp_local_file,
cache = cache)
# check if internet connection worked
if (is.null(check_download)) { # nocov start
if (is.null(check_download)) {
message("Problem connecting to ANAC data server. Please try it again.") #nocov
return(invisible(NULL)) #nocov
}
Expand Down
8 changes: 4 additions & 4 deletions R/utils_airfares.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ get_airfares_dates_available <- function(dom) {
#' # Generate url
#' a <- get_airfares_url(year=2002, month=11)
#'}}
get_airfares_url <- function(dom,
date = parent.frame()$date) { # nocov start
get_airfares_url <- function(dom, # nocov start
date = parent.frame()$date) { # nocov end

# Domestic flights
if( isTRUE(dom) ) {
Expand Down Expand Up @@ -213,8 +213,8 @@ download_airfares_data <- function(file_urls = parent.frame()$file_urls,
cache = cache)
# check if internet connection worked
if (is.null(check_download)) { # nocov start
message("Problem connecting to ANAC data server. Please try it again.") #nocov
return(invisible(NULL)) #nocov
message("Problem connecting to ANAC data server. Please try it again.") # nocov
return(invisible(NULL)) # nocov
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/utils_airport_movement.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ download_airport_movement_data <- function(file_url = parent.frame()$file_url,
data.table::setDTthreads(orig_threads)

return(dt)
}
} # nocov end


2 changes: 1 addition & 1 deletion R/utils_flightst.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ download_flights_data <- function(file_url = parent.frame()$file_url,
if (is.null(check_download)) { # nocov start
message("Problem connecting to ANAC data server. Please try it again.") #nocov
return(invisible(NULL)) #nocov
}
} # nocov end
}


Expand Down
22 changes: 12 additions & 10 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ Duration: 8m 26.7s

# flightsbr dev v1.0.0

* Major changes:
* Fixed ANAC's broken link of public airports
* Functions `read_flights()`, `read_airport_movements()`, and `read_aircrafts()` now accept vectors of dates like `c(202201, 202301)` or `c(2022, 2024)`
* Functions `read_airports()` and `read_aircrafts()` now has a `cache` parameter.
* Breaking changes:
* The names of all columns in the data outputs are now cleanned with {janitor}
* Function `read_airports()` now downloads v2 version of public airports data. Closes [#41](https://github.com/ipeaGIT/flightsbr/issues/41)

* Major changes:
* Function `read_airfares()` is working again. Closes [#30](https://github.com/ipeaGIT/flightsbr/issues/30). The prices of air tickets are now returned as numeric.
* Function `read_flights()` with fixed decimal values in numeric columns. Closes [#43](https://github.com/ipeaGIT/flightsbr/issues/43)
* Function `read_airports()` with fixed numeric values for `"altitude"` column. Closes [#42](https://github.com/ipeaGIT/flightsbr/issues/42)

* Minor changes:
* Removed dependency on the {httr} package
* Now using curl::multi_download() to download files in parallel. This brings the advantage that the pacakge now automatically detects whether the data file has been updated and should be downloaded again.
* Streamlined functions to simplify package maintenance and improve performance
* Using {fs} to manage file paths and {archive} to unzip files
* Reorganization of internal functions to simplify package maintenance

* Internally check of the consistency of date inputs. The date input must be consistent in either a 6-digit format `yyyymm` OR a 4-digit format `yyyy`.
* New support function `latest_airfares_date()`
* Fix error that stopped reading aircraft data `read_aircrafts()` for multiple months when the number of collums differed across months. Fixed using `data.table::rbindlist(fill = TRUE)`

0 comments on commit 57efbcb

Please sign in to comment.