bug
This commit is contained in:
@@ -448,6 +448,9 @@ func (a *App) startup(ctx context.Context) {
|
||||
if _, err := applog.Init(dataDir); err != nil {
|
||||
fmt.Println("OpsLog: log init:", err)
|
||||
}
|
||||
// Route CAT/OmniRig debug lines into the unified app log (they used to go
|
||||
// to a separate cat.log in the old HamLog folder, which users couldn't find).
|
||||
cat.LogSink = applog.Printf
|
||||
applog.Printf("startup: data dir = %s", dataDir)
|
||||
conn, err := db.Open(a.dbPath)
|
||||
if err != nil {
|
||||
@@ -544,11 +547,12 @@ func (a *App) startup(ctx context.Context) {
|
||||
// from settings and host callbacks to build ADIF, stamp the upload
|
||||
// status and surface errors to the UI.
|
||||
a.extsvc = extsvc.NewManager(extsvc.Deps{
|
||||
BuildADIF: a.buildUploadADIF,
|
||||
MarkUploaded: a.markExtUploaded,
|
||||
NotifyError: a.notifyExtError,
|
||||
ShouldUpload: a.extShouldUpload,
|
||||
Logf: applog.Printf,
|
||||
BuildADIF: a.buildUploadADIF,
|
||||
MarkUploaded: a.markExtUploaded,
|
||||
NotifyError: a.notifyExtError,
|
||||
ShouldUpload: a.extShouldUpload,
|
||||
StationCallOf: a.stationCallOf,
|
||||
Logf: applog.Printf,
|
||||
})
|
||||
a.extsvc.SetConfig(a.loadExternalServices())
|
||||
|
||||
@@ -998,6 +1002,13 @@ func (a *App) ListCountries() []string {
|
||||
return a.dxcc.EntityNames()
|
||||
}
|
||||
|
||||
// DXCCForCountry returns the ADIF DXCC entity number for a country/entity
|
||||
// name (as listed by ListCountries), or 0 if unknown. The QSO editor uses it
|
||||
// to keep the read-only DXCC field in sync when the user picks a Country.
|
||||
func (a *App) DXCCForCountry(name string) int {
|
||||
return dxcc.EntityDXCC(name)
|
||||
}
|
||||
|
||||
// ComputeStationInfo resolves a station's structured metadata from the
|
||||
// callsign (via cty.dat) and grid (via Maidenhead → lat/lon). The
|
||||
// frontend calls this whenever Callsign or Grid changes in the Station
|
||||
@@ -2424,6 +2435,19 @@ func (a *App) buildUploadADIF(id int64, forceCall string) (string, bool) {
|
||||
return adif.SingleRecordADIF(q), true
|
||||
}
|
||||
|
||||
// stationCallOf returns the QSO's STATION_CALLSIGN (upper-cased), used by the
|
||||
// uploader to verify a QSO belongs to the target logbook's callsign.
|
||||
func (a *App) stationCallOf(id int64) string {
|
||||
if a.qso == nil {
|
||||
return ""
|
||||
}
|
||||
q, err := a.qso.GetByID(a.ctx, id)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return strings.ToUpper(strings.TrimSpace(q.StationCallsign))
|
||||
}
|
||||
|
||||
// extShouldUpload reports whether a QSO is eligible for upload to a service,
|
||||
// based on its sent status. QRZ/Club Log upload anything not yet "Y"; LoTW
|
||||
// uploads only QSOs whose lotw_sent matches the configured Upload flag
|
||||
@@ -2438,9 +2462,17 @@ func (a *App) extShouldUpload(svc extsvc.Service, id int64) bool {
|
||||
}
|
||||
switch svc {
|
||||
case extsvc.ServiceQRZ:
|
||||
return !strings.EqualFold(q.QRZComUploadStatus, "Y")
|
||||
if strings.EqualFold(q.QRZComUploadStatus, "Y") {
|
||||
applog.Printf("extsvc: QSO %d not eligible for qrz — QRZComUploadStatus already %q (set Confirmations default to N to upload)", id, q.QRZComUploadStatus)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
case extsvc.ServiceClublog:
|
||||
return !strings.EqualFold(q.ClublogUploadStatus, "Y")
|
||||
if strings.EqualFold(q.ClublogUploadStatus, "Y") {
|
||||
applog.Printf("extsvc: QSO %d not eligible for clublog — ClublogUploadStatus already %q (set Confirmations default to N to upload)", id, q.ClublogUploadStatus)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
case extsvc.ServiceLoTW:
|
||||
flag := "R"
|
||||
if a.settings != nil {
|
||||
@@ -2952,7 +2984,11 @@ func (a *App) SetCATFrequency(hz int64) error {
|
||||
if a.cat == nil {
|
||||
return fmt.Errorf("cat not initialized")
|
||||
}
|
||||
return a.cat.SetFrequency(hz)
|
||||
err := a.cat.SetFrequency(hz)
|
||||
if err != nil {
|
||||
applog.Printf("cat: SetFrequency(%d Hz) dispatch error: %v", hz, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SetCATMode sets the rig's mode. ADIF mode names (SSB / CW / FT8 / …) are
|
||||
@@ -2961,7 +2997,11 @@ func (a *App) SetCATMode(mode string) error {
|
||||
if a.cat == nil {
|
||||
return fmt.Errorf("cat not initialized")
|
||||
}
|
||||
return a.cat.SetMode(mode)
|
||||
err := a.cat.SetMode(mode)
|
||||
if err != nil {
|
||||
applog.Printf("cat: SetMode(%q) dispatch error: %v", mode, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// SwitchCATRig hot-swaps the active OmniRig slot (Rig1 ↔ Rig2) without
|
||||
|
||||
Reference in New Issue
Block a user