Skip to content
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

Query Monsters by size and hit points #481

Merged
merged 2 commits into from
Jul 20, 2024

Conversation

Sturlen
Copy link
Contributor

@Sturlen Sturlen commented Jul 17, 2024

These fields were not searchable. This created a problem for the new Pagination feature for the Open5e site, which now relies on the API for filtering.

Copy link
Contributor

@calumbell calumbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, works great on local! Query params on the endpoints /monsters/?ordering=size, /monsters/?ordering=-size ,/monsters/?ordering=hit_points, /monsters/?ordering=-hit_points return sorted results as expected. Nothing breaks and tests pass.

One small weirdness is that ordering by size doesn’t actually order by how large a monster is (tiny → small → medium → large) but by how the names of these size catagories sort alphabetically (garganutan → … → titanic). I believe this issue is already being addressed in API V2

@calumbell calumbell merged commit d0ca7ec into open5e:staging Jul 20, 2024
3 checks passed
@Sturlen Sturlen deleted the monster-size-and-hp-search branch July 22, 2024 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants