Format numbers so scientific notation isn't used in paging parameters #151
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Our package bcdata uses {crul} to get spatial data from a WFS server - some of these are very large and require paged requests with rows into the hundreds of thousands. Scientific number formatting of paging parameters can sometimes result in requests looking like this (note the
startIndex
value):This returns 1000 records, but doesn't start at the correct spot (I'm not totally sure how
1e+05
is interpreted by the server though I think it might just be ignored).This fix formats numbers as character (avoiding scientific notation) when they are added to the query.
Example
With the submitted fix it looks like this:
I also updated the
url_fetch()
tests to use larger numbers (that would be converted to scientific notation) and a test for the new utility functionnum_format()
.Addresses bcgov/bcdata#235