Skip to content

Fix day-of-year, compass point, async context and display defects; add tests - #38

Open
Gabriel-Dalton wants to merge 2 commits into
bcgov:mainfrom
Gabriel-Dalton:fix/logic-and-display
Open

Fix day-of-year, compass point, async context and display defects; add tests#38
Gabriel-Dalton wants to merge 2 commits into
bcgov:mainfrom
Gabriel-Dalton:fix/logic-and-display

Conversation

@Gabriel-Dalton

Copy link
Copy Markdown

A few real defects found while reading through the app, plus tests covering them.

Logic

  • getDayOfYear returned 0 for January 1st and could shift by a day across a DST boundary because it subtracted local DateTimes. Day-of-year feeds foliar moisture content, so this changed predictions.
  • degreesToCompassPoint was off by half a sector. 20 degrees reported "N" instead of "NNE". It could also throw on values outside 0-360 instead of wrapping.
  • Loaded settings were not pinned to their valid ranges. A stale saved FFMC, curing, wind azimuth or aspect could restore the app into a state it could not calculate from.

Crash risks

  • Two BuildContext uses across await gaps (the disclaimer dialog and the delayed scroll) with no mounted check.
  • _getPosition returns null on error, but the caller dereferenced the result.

Display

  • Fire size rendered the literal string "null" when unavailable, and the label read "60.0 minute fire size".
  • Wind direction and aspect rendered raw doubles inconsistently ("157.5" next to "0.0").
  • The FMC screen showed unrounded floats with no units.
  • Sentence-case labels, a tooltip on the previously unlabelled location button, a dead switch default and a duplicate dev dependency in pubspec.yaml.

Verification

flutter analyze reports no errors (remaining items are the pre-existing CFFDRS naming lints). flutter test passes 25/25, including 10 new tests in test/fire_test.dart covering day-of-year, compass points, intensity classes and range pinning.

Copy and grammar fixes are kept in a separate PR.

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