This commit is contained in:
2026-05-28 11:09:07 +02:00
parent a8b7622667
commit d3c9982c66
8 changed files with 380 additions and 200 deletions
+31 -9
View File
@@ -228,11 +228,18 @@ func (a *App) startup(ctx context.Context) {
})
a.reloadCAT()
// DX Cluster (multi-server): spot callback pushes individual spots,
// status callback signals "something changed" so the frontend can
// fetch the aggregate via GetClusterStatus.
// DX Cluster (multi-server): the spot callback enriches each spot
// with country + continent via cty.dat BEFORE emitting it, so the UI
// renders the row with all metadata already filled (no flicker of
// empty Country / Cont columns while the batch status fetch runs).
a.cluster = cluster.NewManager(
func(s cluster.Spot) {
if a.dxcc != nil {
if m, ok := a.dxcc.Lookup(s.DXCall); ok && m.Entity != nil {
s.Country = m.Entity.Name
s.Continent = m.Continent
}
}
if a.ctx != nil {
wruntime.EventsEmit(a.ctx, "cluster:spot", s)
}
@@ -1383,11 +1390,12 @@ type SpotQuery struct {
// "worked" — exact band+mode already in the log
// "" — couldn't resolve the entity (no cty.dat match)
type SpotStatus struct {
Call string `json:"call"`
Band string `json:"band"`
Mode string `json:"mode"`
Country string `json:"country,omitempty"`
Status string `json:"status"`
Call string `json:"call"`
Band string `json:"band"`
Mode string `json:"mode"`
Country string `json:"country,omitempty"`
Continent string `json:"continent,omitempty"`
Status string `json:"status"`
}
// ClusterSpotStatuses takes a batch of spots and returns slot status for
@@ -1403,7 +1411,20 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
if a.qso == nil {
return out
}
entities, err := a.qso.EntitySlotMap(a.ctx)
// Pass a cty.dat-backed resolver so the past-QSO map uses the SAME
// entity name we'll compare each spot against. Without it QRZ-stored
// "Turkey" wouldn't match cty.dat's "Asiatic Turkey" → false NEW.
resolveEntity := func(callsign string) string {
if a.dxcc == nil {
return ""
}
m, ok := a.dxcc.Lookup(callsign)
if !ok || m.Entity == nil {
return ""
}
return m.Entity.Name
}
entities, err := a.qso.EntitySlotMap(a.ctx, resolveEntity)
if err != nil {
return out
}
@@ -1422,6 +1443,7 @@ func (a *App) ClusterSpotStatuses(spots []SpotQuery) []SpotStatus {
}
country := strings.ToLower(m.Entity.Name)
out[i].Country = m.Entity.Name
out[i].Continent = m.Continent
e, worked := entities[country]
if !worked {
out[i].Status = "new"