Skip to content

APR-234: fix AttributeError in plan generator and inaccurate lake map coords#50

Merged
JacobSampson merged 1 commit into
mainfrom
APR-234/fix-fishing-bugs
Jun 8, 2026
Merged

APR-234: fix AttributeError in plan generator and inaccurate lake map coords#50
JacobSampson merged 1 commit into
mainfrom
APR-234/fix-fishing-bugs

Conversation

@JacobSampson

Copy link
Copy Markdown
Contributor

Summary

  • Bug 1: _generate_plan_cached in fishing_data.py reconstructed WeatherResult from JSON with pressure_trend as a plain string instead of a PressureTrend enum, causing AttributeError: 'str' object has no attribute 'value' in plan_generator._build_conditions_summary
  • Bug 2: Hardcoded WRIGHT_COUNTY_LAKES coordinates in dnr_map.py could be inaccurate; when the DNR API returns authoritative coordinates for a searched lake, the map dot now moves to the correct position

Changes

  • app/components/fishing_data.py: convert deserialized pressure_trend string → PressureTrend enum and re-derive PressureInterpretation after JSON round-trip
  • app/components/dnr_map.py: add lake_coord_overrides parameter to build_lake_map so callers can inject live DNR coordinates
  • app/pages/fishing.py: extract DNR API coordinates from search results and pass as overrides to build_lake_map
  • tests/test_plan_generator.py: regression tests covering all PressureTrend variants for the JSON round-trip (Bug 1)
  • tests/test_dnr_map_bathymetry.py: tests for the lake_coord_overrides parameter (Bug 2)

Test Plan

  • All unit tests pass (PYTHONPATH=src:app pytest tests/)
  • TestWeatherJsonRoundTrip — 22 new parametrized tests cover the fixed round-trip for every PressureTrend value
  • TestLakeCoordOverrides — 4 new tests verify override/fallback behaviour in build_lake_map

Closes: APR-234

🤖 Generated with Claude Code

Bug 1 (APR-234): fishing_data._generate_plan_cached reconstructed
WeatherResult from JSON with pressure_trend as a plain string, not the
PressureTrend enum.  plan_generator._build_conditions_summary then called
.value on the string, raising AttributeError.  Fix: after JSON
deserialization, convert the string back to the enum and re-derive a
PressureInterpretation so the conditions summary is complete.

Bug 2 (APR-234): depth-contour dots on the lake map used hardcoded
WRIGHT_COUNTY_LAKES coordinates that may not match the actual physical
lake position.  Fix: add a lake_coord_overrides parameter to
build_lake_map; when a DNR API search result resolves a lake that already
exists in WRIGHT_COUNTY_LAKES, fishing.py now extracts the authoritative
DNR coordinates and passes them as overrides so the dot moves to the
correct position.

Adds regression tests covering all PressureTrend variants for the
JSON round-trip and four tests for the coordinate-override path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codesandbox

codesandbox Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@JacobSampson JacobSampson merged commit bb13f39 into main Jun 8, 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.

1 participant