diff --git a/R/get_smips.R b/R/get_smips.R index c990014..714fc12 100644 --- a/R/get_smips.R +++ b/R/get_smips.R @@ -31,7 +31,7 @@ get_smips <- function(collection = "totalbucket", url_date <- gsub("-", "", day) url_year <- lubridate::year(day) - .check_collection_agreement(.collection = collection, .url_date = url_date) + .check_collection_agreement(.collection = collection, .day = day) approved_collections <- c("totalbucket", "SMindex", @@ -67,14 +67,14 @@ get_smips <- function(collection = "totalbucket", return(r) } -.check_collection_agreement <- function(.collection, .url_date) { +.check_collection_agreement <- function(.collection, .day) { .this_year <- lubridate::year(lubridate::today()) .last_week <- lubridate::today() - 7 - .url_year <- lubridate::year(.url_date) + .url_year <- lubridate::year(.day) if (.collection == "totalbucket" && .url_year < 2005 || - .url_date > .last_week) { + .day > .last_week) { cli::cli_abort("The data are not available before 2005 and past {.last_week}") } }