APR-234: fix AttributeError in plan generator and inaccurate lake map coords#50
Merged
Conversation
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>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
_generate_plan_cachedinfishing_data.pyreconstructedWeatherResultfrom JSON withpressure_trendas a plain string instead of aPressureTrendenum, causingAttributeError: 'str' object has no attribute 'value'inplan_generator._build_conditions_summaryWRIGHT_COUNTY_LAKEScoordinates indnr_map.pycould be inaccurate; when the DNR API returns authoritative coordinates for a searched lake, the map dot now moves to the correct positionChanges
app/components/fishing_data.py: convert deserializedpressure_trendstring →PressureTrendenum and re-derivePressureInterpretationafter JSON round-tripapp/components/dnr_map.py: addlake_coord_overridesparameter tobuild_lake_mapso callers can inject live DNR coordinatesapp/pages/fishing.py: extract DNR API coordinates from search results and pass as overrides tobuild_lake_maptests/test_plan_generator.py: regression tests covering allPressureTrendvariants for the JSON round-trip (Bug 1)tests/test_dnr_map_bathymetry.py: tests for thelake_coord_overridesparameter (Bug 2)Test Plan
PYTHONPATH=src:app pytest tests/)TestWeatherJsonRoundTrip— 22 new parametrized tests cover the fixed round-trip for everyPressureTrendvalueTestLakeCoordOverrides— 4 new tests verify override/fallback behaviour inbuild_lake_mapCloses: APR-234
🤖 Generated with Claude Code