Bugfix: ClassFeature "gained_at" and "table_data" fields no longer mutually exclusive
#666
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
This PR fixes a bug on the
/classesendpoint where ClassFeatures that contained both tabular and non-tabular data would only return the tabular data.The example used in the issue that this closes was the WOTC SRD Rogue’s Sneak Attack feature, should contains both
”table_data”to display in the Class Table (a column showing much damage sneak attack deals at each level), and “gained_at” information (which levels a feature is gained at).Previously, the API would only return one or the other. Now it can return both:
/v2/classes/srd_rogueThis fix was made by updating the logic that seperated “gained_at” and “table_data” on the ClassFeature serializer to handle the edge-case where a feature appears a both a table column and a feature in the body text (Rogue’s Sneak Attack, and Monk’s Martial Arts and Unarmored Movement are all examples of this.
Related Issue
Closes #651
How has this been tested
The feature was principally tested using A/B testing between the feature and staging branches to make sure that it is working as intended. The
/v2/classes/srd_rogueendpoint was visited on both branches and the JSON payload compared.Pytest was also run to make sure that there were no unintended consequences to this fix. No tests needed to be updated.