Skip to content

Commit

Permalink
tidy code
Browse files Browse the repository at this point in the history
  • Loading branch information
evanodell committed Nov 8, 2019
1 parent 21d0850 commit a2d8f95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/changes.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' end_date = "2019-03-12"
#' )
#' }

#'
cqc_changes <- function(organisation_type = c("provider", "location"),
start_date = "2000-01-01", end_date = Sys.Date(),
verbose = TRUE, clean_names = TRUE) {
Expand Down
9 changes: 4 additions & 5 deletions R/location_details.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ cqc_location_details <- function(x, location_col = "location_id",
if (verbose) {
if (requireNamespace("pbapply", quietly = TRUE)) {
loc_list <- pbapply::pblapply(x[[location_col]], cqc_location,
clean_names = clean_names)
clean_names = clean_names
)
} else {
warning("Package \"pbapply\" is needed if `verbose=TRUE`
Please install to see a progress bar.",
call. = TRUE, immediate. = TRUE
call. = TRUE, immediate. = TRUE
)

loc_list <- lapply(x[[location_col]], cqc_location,
clean_names = clean_names
clean_names = clean_names
)

}

} else {
loc_list <- lapply(x[[location_col]], cqc_location,
clean_names = clean_names
Expand Down
6 changes: 4 additions & 2 deletions R/utils-query-construct.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ cqc_query_construction <- function(query) {
x <- httr::GET(query2)

if (httr::status_code(x) != "200") {
stop(paste("Request returned error code:",
httr::status_code(x)), call. = FALSE)
stop(paste(
"Request returned error code:",
httr::status_code(x)
), call. = FALSE)
}

suppressMessages(cont <- jsonlite::fromJSON(httr::content(x, "text")))
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-locations.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ test_that("big location works", {
expect_true(tibble::is_tibble(loc8))
expect_length(loc8, 3)

expect_message(loc9 <- cqc_locations_search(care_home = TRUE,
region = "North West"))
expect_message(loc9 <- cqc_locations_search(
care_home = TRUE,
region = "North West"
))

expect_true(tibble::is_tibble(loc9))
expect_length(loc9, 3)
Expand All @@ -73,5 +75,4 @@ test_that("big location works", {
loc3_details <- cqc_location_details(loc3, verbose = FALSE)
expect_true(is.list(loc3_details))
expect_equal(class(loc3_details[[1]]), "list")

})

0 comments on commit a2d8f95

Please sign in to comment.