Skip to content

Commit

Permalink
Fix getting last page for paginated downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
wkmor1 committed Nov 17, 2023
1 parent dbd62ed commit 57c3e04
Show file tree
Hide file tree
Showing 2 changed files with 5,863 additions and 52 deletions.
12 changes: 10 additions & 2 deletions R/finbif_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,8 @@ get_extra_pages <- function(fb_records_list) {

while (multipage) {

current_page_size <- page_size

if (!quiet) {

utils::setTxtProgressBar(pb, i)
Expand All @@ -889,11 +891,11 @@ get_extra_pages <- function(fb_records_list) {

if (page == n_pages + 1) {

page_size <- n %% page_size
current_page_size <- n %% page_size

}

if (page == n_pages + 2 || page_size == 0) {
if (page == n_pages + 2 || current_page_size == 0) {

break

Expand Down Expand Up @@ -921,6 +923,12 @@ get_extra_pages <- function(fb_records_list) {

records_i <- value(res)

results <- c("content", "results")

results_seq <- seq_len(current_page_size)

records_i[[results]] <- records_i[[results]][results_seq]

records_i <- c(records_i, locale = fb_records_list[[i]][["locale"]])

i <- i + 1L
Expand Down
Loading

0 comments on commit 57c3e04

Please sign in to comment.