fix: Showing beam heading on map even if no call is entered

This commit is contained in:
2026-06-22 21:46:41 +02:00
parent 824971d0a1
commit 79dc20a859
9 changed files with 109 additions and 36 deletions
+16 -3
View File
@@ -11,14 +11,16 @@ import (
"log"
"os"
"path/filepath"
"runtime/debug"
"sync"
"time"
)
var (
mu sync.Mutex
file *os.File
path string
mu sync.Mutex
file *os.File
path string
crashFile *os.File // kept open so the runtime can write a crash traceback to it
)
// Init opens (creates) the log file in dataDir. On rotation we truncate
@@ -57,6 +59,17 @@ func Init(dataDir string) (string, error) {
file = f
path = logPath
// Capture a full traceback on a FATAL crash (a Go panic that escapes our
// recover()s, or a runtime-fatal error like a concurrent map write, or a
// Windows access violation routed through the Go signal handler) into a
// dedicated file the runtime writes directly — so otherwise-silent process
// deaths leave a stack we can read.
if cf, cerr := os.OpenFile(filepath.Join(dataDir, "opslog-crash.log"),
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644); cerr == nil {
crashFile = cf
_ = debug.SetCrashOutput(cf, debug.CrashOptions{})
}
// Redirect log.Print* and the standard logger to the file too, so
// any third-party output stays consistent.
log.SetOutput(io.MultiWriter(file, os.Stderr))
+5 -2
View File
@@ -1621,8 +1621,9 @@ func scanAwardQSO(s scanner) (QSO, error) {
// NEW / NEW SLOT / WORKED in constant time after one batched query.
type EntitySlot struct {
Country string
Bands map[string]struct{} // bands worked, any mode
Slots map[string]map[string]struct{} // band → modes worked
Bands map[string]struct{} // bands worked, any mode
Modes map[string]struct{} // modes worked, any band
Slots map[string]map[string]struct{} // band → modes worked
}
// EntitySlotMap returns slot data for every QSO, grouped by DXCC entity NUMBER.
@@ -1667,11 +1668,13 @@ func (r *Repo) EntitySlotMap(ctx context.Context, keyFor func(call string, store
e = &EntitySlot{
Country: country,
Bands: make(map[string]struct{}),
Modes: make(map[string]struct{}),
Slots: make(map[string]map[string]struct{}),
}
out[key] = e
}
e.Bands[band] = struct{}{}
e.Modes[mode] = struct{}{}
bandSlots, ok := e.Slots[band]
if !ok {
bandSlots = make(map[string]struct{})