fix: re-materialize award_refs so new matching rules reach existing QSOs
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.
This commit is contained in:
@@ -3415,6 +3415,10 @@ func (a *App) invalidateAwardStats() {
|
|||||||
// flips qsl_rcvd flags on existing rows).
|
// flips qsl_rcvd flags on existing rows).
|
||||||
func (a *App) RescanAwards() error {
|
func (a *App) RescanAwards() error {
|
||||||
a.invalidateAwardStats()
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3821,7 +3825,12 @@ func (a *App) recomputeAwardRefsAsync() {
|
|||||||
|
|
||||||
// keyAwardsMaterialized marks (per profile / logbook) that the one-time award_refs
|
// 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.
|
// 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
|
// 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
|
// (or were logged by an older client that didn't materialise them). It runs at
|
||||||
|
|||||||
Reference in New Issue
Block a user