From c86d331bd911ec1a64adfd2ef1361f971769fa81 Mon Sep 17 00:00:00 2001 From: rouggy Date: Mon, 20 Jul 2026 13:41:14 +0200 Subject: [PATCH] fix: re-materialize award_refs so new matching rules reach existing QSOs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The one-shot award_refs backfill never revisited rows after it ran, so a QSO materialized before an award gained a rule kept stale values — e.g. DDFM's postal-code OR-rule matched nothing on the 500+ French QSOs whose department comes from the address, only the handful with it typed in notes. Two fixes: bump the backfill flag (awards.materialized.v2) so every operator re-materializes once on next launch with their current definitions, and make RescanAwards (the Awards tab Rescan button) also recompute award_refs for an on-demand refresh. --- app.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index daf0a53..073ecd8 100644 --- a/app.go +++ b/app.go @@ -3415,6 +3415,10 @@ func (a *App) invalidateAwardStats() { // flips qsl_rcvd flags on existing rows). func (a *App) RescanAwards() error { a.invalidateAwardStats() + // Also refresh the materialised award_refs on every QSO (the grid columns read + // from there). Manual trigger for when a definition/reference change should be + // re-applied to existing rows on demand rather than waiting for the next event. + a.recomputeAwardRefsAsync() return nil } @@ -3821,7 +3825,12 @@ func (a *App) recomputeAwardRefsAsync() { // keyAwardsMaterialized marks (per profile / logbook) that the one-time award_refs // backfill has run, so it doesn't re-scan the whole logbook on every launch. -const keyAwardsMaterialized = "awards.materialized.v1" +// keyAwardsMaterialized is versioned: bump the suffix to force every operator to +// re-materialise award_refs once on next launch. Needed when the stored values +// could be stale against the CURRENT award definitions — e.g. rows materialised +// before an award gained a new matching rule (DDFM's postal-code OR-rule), which +// the one-shot backfill would otherwise never revisit. +const keyAwardsMaterialized = "awards.materialized.v2" // backfillAwardRefsOnce populates award_refs for QSOs that predate the feature // (or were logged by an older client that didn't materialise them). It runs at