-
Couldn't load subscription status.
- Fork 26
Enforce integer during pagination #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi @awong234 Nice catch! I'm just waiting for some restarted tests to pass, but I expect I will merge this shortly. Thanks! PS May I add you to the contributors? |
R/boxr_misc.R
Outdated
| #' examining the contents of local directories. | ||
| #' | ||
| #' @export | ||
| box_ls_short <- function(dir_id = box_getwd(), limit = 1000, max = Inf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rerun document()? TravisCI found a mismatch between this and the .Rd file. Thanks!
|
PPS If you are re-running |
|
Hi Alec, I had a closer look at the function It would solve my concern if, instead of adding a new function, we were to add an argument to If filelds_all <-
c("modified_at" ,"content_modified_at", "name", "id", "type",
"sha1" ,"size", "owned_by", "path_collection", "description")
if (is.null(fields)) {
fields <- fields_all
} else {
assertthat::assert_that(
all(fields %in% fields_all),
msg = paste("all fields must be in", paste(fields_all, collapse = ", "))
)
}In summary my proposal is to:
What do you think? Let me know if you would like to take this on. If not, I can make the change after accepting the PR. |
R/boxr_misc.R
Outdated
| #' @return A data.frame describing the contents of the the folder specified by | ||
| #' \code{dir_id}. Non recursive. | ||
| #' | ||
| #' @author Alec Wong \email{[email protected]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For your email address to format properly, you will have to use @@.
… for box_ls from Ian Lyttle for querying fewer fields, if so desired.
|
Hi Ian, Thanks for the tips! I would be happy to be listed as among the contributors. I've integrated your suggestions in a new commit, and made the other changes you requested. Let me know if there is something missing. |
R/boxr_misc.R
Outdated
|
|
||
| fields <- c("modified_at" ,"content_modified_at", "name", "id", "type", | ||
| "sha1" ,"size", "owned_by", "path_collection", "description") | ||
| filelds_all <- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a typo on my part - should be fields_all.
Can you build-and-install on your end, just to make sure the function works as you expect?
In the longer term, I will have to look more-closely at the tests.
Thanks!
|
|
||
| filelds_all <- | ||
| fields_all <- | ||
| c("modified_at" ,"content_modified_at", "name", "id", "type", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also need an entry at line 6 to document the fields argument, something like:
#` @param fields Default (`NULL`) returns all possible columns:
#` `"modified_at"`, `"content_modified_at"`, `"name"`, `"id"`, `"type"`, `"sha1"`,
#` `"size"`, `"owned_by"`, `"path_collection"`, `"description"`.
#` To return a subset of columns, specify as a character vector.
#` If you document() again (and let me know that it works as you expect), I think we're there!
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right! Will do
|
Hi Alec, Just to be sure before I merge, |
|
Hi Ian, Just tested functionality now, they return values as expected. Thanks! |
|
Thanks! 🎉 |
See issue 71.
box_lset cetera return HTTP status 400: Bad Request duringbox_paginationexecution. The issue was found to be that R explicitly uses scientific notation when the offset (or any number) >= 100,000; below this, I suppose it supplies an integer or something recognizable by the Box API as an integer.The only relevant change here is line 57 in
boxr_misc.R, withinbox_pagination().The other stuff is just ad hoc functions I included, but may be valuable for users with large data storage;
box_ls_shortjust queries the "name" field from the folder, speeding up the query by about 35%. Do you have any other suggestions for speeding upbox_lswhen the directory is big (>1e5 files)?Sorry if it's a little messy with all the files being changed, I don't have much experience with
Roxygen2to selectively update the stuff, but I imagine you can easily change things here and there on your end.