-
Notifications
You must be signed in to change notification settings - Fork 101
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
Sorting Issue: Incorrect Order when Sorting Monsters by Size #399
Comments
This is because the API lacking any awareness for what "size" classification means in D&D and is just sorting alphabetically. A possible solution is to add a new numeric field e.g. Size is defined here on the Monster Model: open5e-api/api/models/monster.py Line 11 in b16e3d1
|
Thanks. So just to be sure, I need to add the representation in open5e-api/api/models/monster.py and I need to add the data itself in the for all the monsters in the json. Do i need to change something in api_v2? |
also i have found that there is a file Monster.json_SKIPPED. do i need to change it? |
i have created a pull request that can be seen here #401 |
I have an alternative solution to this that covers all approaches in #425 |
It looks great! Does it require any changes to the monster.json?. |
I'm calling this resolved within V2. While it doesn't solve v1 at this time, the long-term plan will be to transition to v2. This feature is fully supported in v2 by doing a size lookup for any creature or item, then sorting on the Rank field. |
Issue:
When attempting to sort monsters by size using the Open5E API, there is an inconsistency in the sorting order. Currently, when sorting in descending order, the first results include "Titanic" monsters, followed by "Tiny" monsters, which deviates from the expected sorting order.
Steps to Reproduce:
Use the API endpoint for sorting monsters by size in descending order: https://api.open5e.com/monsters/?ordering=-size
Observe that the first results include "Titanic" monsters, but instead of continuing in descending order, the subsequent monsters are "Tiny."
Expected Behavior:
When sorting monsters by size in descending order, the expected order should be from the largest size category ("Titanic") to the smallest size category ("Tiny") according to the standard D&D size classification.
Note:
If I'm using the API incorrectly, please clarify the correct usage. However, if this is indeed a bug, I am willing to try to solve it and submit a pull request.
Thank you for your assistance!
The text was updated successfully, but these errors were encountered: