From 0fa91c3d5f836ccc3bca09fcbb9469f4cb7bd93c Mon Sep 17 00:00:00 2001 From: rouggy Date: Mon, 20 Jul 2026 13:57:50 +0200 Subject: [PATCH] feat: ship DDFM v2 (postal-code OR-rule) via the award catalog so it reaches the team MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DDFM now derives the French department from the address postal code, not only from a note typed by hand — the catalog def gains the address OR-rule (\d{2}\d{3} -> Dxx), France+Corsica scope, and version 2. On next launch every operator whose DDFM is unedited auto-upgrades to it (user-edited copies are offered it); the materialised award_refs then recompute so ~500+ French QSOs gain their department. Also: a catalog definition update now clears the award_refs backfill flag, so any future catalog bump self-heals the stored columns without a manual flag bump. --- app.go | 8 ++++++++ internal/award/catalog/ddfm.json | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app.go b/app.go index 073ecd8..9f96858 100644 --- a/app.go +++ b/app.go @@ -2452,6 +2452,14 @@ func (a *App) migrateAwardDefs() { applog.Printf("awards: %s updated from the catalog (v%d)", code, defByCode(migrated, code).Version) a.reseedRefsFromCatalog(code) } + // A catalog definition changed (e.g. DDFM gained the postal-code OR-rule), so + // the materialised award_refs on existing QSOs are now stale. Clear the + // one-shot backfill flag; backfillAwardRefsOnce runs later in startup and will + // re-materialise every row against the updated definitions. This makes ANY + // future catalog bump self-heal the stored columns without a manual flag bump. + if len(updated) > 0 { + _ = a.settings.Set(a.ctx, keyAwardsMaterialized, "") + } // Version-gated correction of the built-in awards' Validate sources, which // an earlier version wrongly set equal to Confirm (so VALIDATED == CONFIRMED // even for paper-QSL-only entities). Re-apply the canonical Confirm/Validate diff --git a/internal/award/catalog/ddfm.json b/internal/award/catalog/ddfm.json index 039103e..b56195e 100644 --- a/internal/award/catalog/ddfm.json +++ b/internal/award/catalog/ddfm.json @@ -7,8 +7,17 @@ "type": "QSOFIELDS", "field": "note", "pattern": "(?i)\\b(D\\d{1,2}[AB]?)\\b", + "or_rules": [ + { + "field": "address", + "match_by": "code", + "pattern": "\\b(\\d{2})\\d{3}\\b", + "prefix": "D" + } + ], "dxcc_filter": [ - 227 + 227, + 214 ], "confirm": [ "lotw", @@ -17,7 +26,9 @@ "validate": [ "lotw" ], + "ref_display": "name", "total": 96, - "builtin": true + "builtin": true, + "version": 2 } }