Skip to content

Conversation

@eepMoody
Copy link
Collaborator

@eepMoody eepMoody commented Dec 31, 2025

Converts all distance-related fields from FloatField to IntegerField to eliminate floating-point precision issues (like 0.00000001) in API responses. All distance values are whole numbers (feet), so integers are more appropriate and avoid precision artifacts. Touch fields converted from 0.1 to 0.

Model Changes

  • distance_field() now returns IntegerField instead of FloatField
  • Speed model methods updated to use integer division and return integers
  • Migration created to convert existing database fields

IMPORTANT MERGE ORDER NOTE

This PR must be merged AFTER PR #844 (fix/spell-data-regressions-pr842) to avoid migration conflicts.


Note

Summary

  • Switches all distance fields from FloatField to IntegerField via distance_field() change and migration (creature, creatureactionattack, size.space_diameter, spell.range/shape_size, spellcastingoption.shape_size, weapon.range/long_range).
  • Updates HasSpeed methods to use integer math (//) and return integers; adjusts speed_all serializer field types to integers (nullable where applicable).
  • Aligns API schemas and approved responses to integer distances (e.g., reach, walk/fly/climb/swim, vision ranges, spell ranges, weapon ranges, size space_diameter).

Written by Cursor Bugbot for commit 50ac18e. This will update automatically on new commits. Configure here.

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.

OK, so this is obviously to many lines of JSON for me to review by eye, but a few minutes of spot checking reveals that all appears to be working as intended. The changes to the Python files all look good to me. All tests passing and the Django test server is having no problem building the DB from the data fixtures.

I'm happy, approving and merging to staging

@calumbell calumbell merged commit 5b09d94 into staging Jan 1, 2026
4 checks passed
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.

3 participants