ES /docs

Error occurred during comparing location longitude.

Completeness#

# Plan Item Status Evidence
1 Add .to_f conversion to before and after values in _location_field_changed? method (lines 68-69) to safely convert String to Float before arithmetic PASS app/models/concerns/geo_queriable.rb: lines 68-69 changed from raw assignment to `(...

Acceptance Criteria#

# Criterion Status Evidence
1 geo_queriable.rb line 68: before value has .to_f applied PASS app/models/concerns/geo_queriable.rb: line 68 now reads `before = (saved_changes['sys'][0].try(:[], field)
2 geo_queriable.rb line 69: after value has .to_f applied PASS app/models/concerns/geo_queriable.rb: line 69 now reads `after = (saved_changes['sys'][1].try(:[], field)
3 Changes limited to lines 68-69 only, no other code modified PASS Diff hunk @@ -65,8 +65,8 @@ shows exactly 2 lines removed and 2 lines added; all surrounding context lines are unchanged

Issues Found#

No blocking issues found.

Observations#

  • The parenthesization (... || 0).to_f is correct. It ensures that if try(:[], field) returns nil, the fallback 0 is used, and then .to_f is applied to the final result. Both 0.to_f (returns 0.0) and "127.5".to_f (returns 127.5) behave as expected.
  • If JSONB values are stored as strings in the database, this fix addresses the root cause at the point of use. A deeper fix could normalize values at write time, but that is outside the scope of this plan and not required.
  • The existing rescue StandardError block on line 70 remains intact, preserving the error logging safety net.