-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add an endpoint for get pickersets #1381
Conversation
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.
Having this in the PickerSet class makes a lot more sense, thanks for moving it in there.
Sandbox updated. |
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.
Brilliant.
For other reviewers, this can be tested with:
export API_KEY=review
curl -i -H "Accept: application/json" -H "X-API-KEY: $API_KEY" \
-X GET "https://www.pgdp.org/~rp31/c.branch/api_pickers/api/v1/projects/projectID45b5cfaa0ff81/pickersets"
Thanks, Casey, that helps immensely. @70ray, in looking at the output, the thing that stood out to me is that the numbers don't show the actual character. They're also bracketed by square brackets instead of curly, as with the others. I have a memory of you fixing something similar to that in the code -- is that what's going on here? (see screenshot below of picker set labeled |
Oh, very good catch Sharon! We need to massage those into a string type instead of an int type. I forget exactly how we do that but you are correct we do that elsewhere. |
An easy work-around would be to return pairs [character, name] rather than an assciative array. This would be just as easy for the client to use. So the result would be: |
But it seems an object is not the same sort of thing as an associative array. |
Test has been adjusted so it works with an object. Is this a good solution or would returning the [char, name] pairs be better? I like the pairs better. |
Sandbox updated. |
I think this solution works well. I'm partial to the hash as I think it lets clients easily get the keys via built-in functions. I'm not against the pairs though if you'd rather do that -- both seem acceptable to me. Whichever you prefer is fine. |
I looked at how this appears when it gets to the javascript. Unfortunately the "1: numbers and math" key appears as an integer so the subsets get in the wrong order. mdn says: |
Github doesn't seem to be running the checks |
Conflicts resolved, snadbox updated. |
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 LGTM!
We could avoid the expand_pickersets() function by creating the pickersets with character names to start with but then we would have to change some other stuff to use the data in this form.
Sandbox at: https://www.pgdp.org/~rp31/c.branch/api_pickers