Skip to content

Commit

Permalink
add downstrack progress bars
Browse files Browse the repository at this point in the history
adds to #88
opens #349
  • Loading branch information
maxheld83 committed Nov 29, 2021
1 parent 8d828bb commit 2b43e9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ Imports:
bslib,
curl,
crlite,
lobstr
lobstr,
progressr (>= 0.9.0)
Suggests:
testthat,
subugoetheme,
Expand Down
8 changes: 6 additions & 2 deletions R/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ looped_possibly_cr_works_field <- function(x, field, ...) {
x <- biblids::as_doi(x)
# remove this hackfix https://github.com/subugoe/metacheck/issues/182
x <- as.character(x)
pb <- progressr::progressor(
along = x,
message = "Querying Crossref API (works endpoint) ...",
label = "memoised_possibly_cr_works_field"
)
res <- purrr::map_chr(
x,
memoised_possibly_cr_works_field,
field = field,
function(x) {pb(); memoised_possibly_cr_works_field(x, field = field, ...)},
...
)
res
Expand Down
6 changes: 6 additions & 0 deletions R/pretest.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ tabulate_metacheckable <- function(x, ...) {
# create empty res object
res <- tibble::tibble(doi = x)
prev <- rep_len(TRUE, length(x))
pb <- progressr::progressor(
along = lazyfuns,
message = "Running pretests ...",
label = "pretests"
)
for (i in 1:length(lazyfuns)) {
pb()
curr <- lazyfuns[[i]](x, prev)
res <- tibble::add_column(res, curr, .name_repair = "minimal")
prev <- curr
Expand Down

0 comments on commit 2b43e9a

Please sign in to comment.