Skip to content

Make Worked All States (WAS) award real, with the states still needed#666

Merged
patrickrb merged 3 commits into
devfrom
optio/task-fb6e1be9-b677-4a53-9dbf-055c4fc7e70b
Jul 24, 2026
Merged

Make Worked All States (WAS) award real, with the states still needed#666
patrickrb merged 3 commits into
devfrom
optio/task-fb6e1be9-b677-4a53-9dbf-055c4fc7e70b

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

What & why

Working all 50 US states (WAS) is one of the most popular pursuits in FT8, especially for the large US operator base. FT8AF's Logbook already had a WAS award card — but it was fake: AwardsTab computed the "worked" count from DXCC entities:

current = (stats.dxccEntities * 50 / 340.coerceAtLeast(1)).coerceAtMost(50)

So the number a user saw had nothing to do with which states they'd actually contacted. This PR makes WAS real and, more importantly, shows the operator which states they still need.

How

FT8AF already resolves a QSO's US state from its Maidenhead grid (UsStateLookup, backed by the us_grid_states.json asset). This PR adds a small, pure helper next to the existing logbook heatmap logic:

  • WorkedAllStates.kt
    • WAS_STATES — the 50 states (DC deliberately excluded; it isn't a WAS state).
    • workedStates(grids, gridToState) — distinct worked states, grid→state resolution injected as a lambda so it unit-tests without an Android context.
    • neededStates(worked) — the states still needed, in canonical order.
    • neededStatesPreview(remaining, max) — caps the on-card chip list so a fresh log never renders all 50.

Wiring:

  • Stats tab gains a real Worked All States progress bar (x / 50).
  • Awards tab WAS card now shows the true worked count and, below the bar, a capped preview of the states still needed — the at-a-glance list a WAS chaser actually wants (with a trailing +N chip when there are more).

The count is derived from worked QSOs, consistent with how the existing DXCC / CQ-zone / ITU-zone stats already work.

User benefit

Open the Logbook → Awards and you can immediately see "37/50, still need MT ND WY SD…" instead of a meaningless placeholder number. That's a genuine, everyday tool for the huge base of US FT8 operators chasing WAS.

Tests

New WorkedAllStatesTest (15 cases, plain-JVM — no Robolectric needed): the 50-state list, distinct collection, DC/unresolved-grid exclusion, dedup, locale-insensitive upper-casing, needed-set ordering, and the preview cap/overflow split. Full radio.ks3ckc.ft8af.ui.logbook.* suite passes; compileDebugKotlin / processDebugResources succeed with the new Compose UI and string resources.

Assumptions

  • WAS counts worked states (not LoTW-confirmed), matching the existing DXCC/zone stats in this screen. The card's "confirmed" wording is unchanged for continuity with the other awards.
  • Only states resolvable from a logged grid are counted, which is how every other geographic stat in FT8AF already behaves.

🤖 Generated with Claude Code

The Logbook's WAS award was a placeholder: AwardsTab derived its worked
count from DXCC entities (dxccEntities * 50 / 340), so the number shown had
nothing to do with which US states the operator had actually contacted.

FT8AF already resolves a QSO's US state from its Maidenhead grid
(UsStateLookup), so real WAS progress can be computed straight from the
logbook. This adds a pure WorkedAllStates helper (workedStates / neededStates
/ neededStatesPreview, with DC excluded) and wires it in:

- Stats tab gains a real Worked All States progress bar (x / 50).
- Awards tab's WAS card now shows the true worked count and, below the bar,
  a capped preview of the states still needed -- the at-a-glance list a WAS
  chaser actually wants.

Chasing WAS is one of the most popular FT8 activities for the large US
operator base, so an honest, actionable WAS tracker is a noticeable win.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.35211% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.67%. Comparing base (f8fc1f6) to head (f0edc41).

Files with missing lines Patch % Lines
...lin/radio/ks3ckc/ft8af/ui/logbook/LogbookScreen.kt 0.00% 52 Missing ⚠️
...n/radio/ks3ckc/ft8af/ui/logbook/WorkedAllStates.kt 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #666      +/-   ##
============================================
- Coverage     36.70%   36.67%   -0.04%     
  Complexity      211      211              
============================================
  Files           222      223       +1     
  Lines         27479    27548      +69     
  Branches       3395     3406      +11     
============================================
+ Hits          10087    10104      +17     
- Misses        17147    17198      +51     
- Partials        245      246       +1     
Flag Coverage Δ
android 15.82% <25.35%> (+0.03%) ⬆️
native 9.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tlin/radio/ks3ckc/ft8af/ui/decode/UsStateLookup.kt 82.35% <100.00%> (ø)
...n/radio/ks3ckc/ft8af/ui/logbook/WorkedAllStates.kt 94.44% <94.44%> (ø)
...lin/radio/ks3ckc/ft8af/ui/logbook/LogbookScreen.kt 7.18% <0.00%> (-0.32%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements real Worked All States (WAS) award tracking in the Logbook by deriving distinct worked US states from logged Maidenhead grids, and surfaces the remaining needed states directly in the Awards UI.

Changes:

  • Add pure WAS helper utilities (workedStates, neededStates, neededStatesPreview) with a canonical 50-state list (excluding DC).
  • Wire WAS progress into Logbook stats/awards, including a capped “states needed” chip preview on the WAS award card.
  • Add plain-JVM unit tests covering state collection, ordering, DC/unresolved exclusion, locale-insensitive uppercasing, and preview capping.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/logbook/WorkedAllStates.kt Adds pure helper logic for computing worked/needed WAS states and a capped preview list.
ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/logbook/LogbookScreen.kt Computes WAS from QSO grids via UsStateLookup, displays WAS progress, and renders remaining-state chips on the WAS award card.
ft8af/app/src/main/res/values/strings_compose.xml Adds strings for the WAS label and the “states needed” header.
ft8af/app/src/test/kotlin/radio/ks3ckc/ft8af/ui/logbook/WorkedAllStatesTest.kt Adds unit tests validating the WAS helpers’ correctness and edge cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

patrickrb and others added 2 commits July 24, 2026 09:26
Uppercasing the grid with the default locale could mis-resolve under
the Turkish locale (lower-case 'i' -> dotted 'İ'), missing the ASCII
keys. Normalize at the lookup source so every caller is locale-safe,
and add a Turkish-locale regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…77-4a53-9dbf-055c4fc7e70b

# Conflicts:
#	ft8af/app/src/main/res/values/strings_compose.xml
@patrickrb
patrickrb merged commit a27eee8 into dev Jul 24, 2026
17 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.

2 participants