feat(confirmations): a HamQTH default, and the pending status stops meaning 'sent'
HamQTH joins the Confirmations page with a sent side only — the site publishes no confirmation feed, so there is nothing to receive — and it defaults to R, the same 'still to upload' the other online services get. That default could not have worked as written. HamQTH and HAMLOG.online keep their sent state in an ADIF extra, and eligibility blocked on the key being PRESENT — so an operator setting the natural R default would have stamped every new QSO 'already gone' and silently disabled the very auto-upload the default arms. Eligibility now reads the VALUE: the ADIF pending statuses mean pending, anything else means sent. Guard-tested both ways.
This commit is contained in:
@@ -361,6 +361,7 @@ const (
|
||||
keyQSLDefaultHRDLogStatus = "qsl.hrdlog_status"
|
||||
keyQSLDefaultQRZComStatus = "qsl.qrzcom_status"
|
||||
keyQSLDefaultQRZComCfm = "qsl.qrzcom_confirmed"
|
||||
keyQSLDefaultHamqthStatus = "qsl.hamqth_status"
|
||||
keyQSLDefaultHamlogStatus = "qsl.hamlog_status"
|
||||
keyQSLDefaultHamlogCfm = "qsl.hamlog_confirmed"
|
||||
|
||||
@@ -456,6 +457,9 @@ type QSLDefaults struct {
|
||||
// at "N" here exactly as they do for Club Log.
|
||||
HamlogStatus string `json:"hamlog_status"`
|
||||
HamlogCfm string `json:"hamlog_confirmed"`
|
||||
// HamQTH, same extras story — and SENT only: the site publishes no
|
||||
// confirmation feed, so there is no received side to default.
|
||||
HamqthStatus string `json:"hamqth_status"`
|
||||
}
|
||||
|
||||
// CATSettings is the user-tweakable rig-control configuration. Stored as
|
||||
@@ -10949,6 +10953,7 @@ func defaultQSLDefaults() QSLDefaults {
|
||||
EQSLSent: "R", EQSLRcvd: "N",
|
||||
LOTWSent: "R", LOTWRcvd: "N",
|
||||
ClublogStatus: "R", ClublogCfm: "N", HRDLogStatus: "R",
|
||||
HamqthStatus: "R",
|
||||
QRZComStatus: "R", QRZComCfm: "N",
|
||||
}
|
||||
}
|
||||
@@ -10970,6 +10975,7 @@ func (a *App) GetQSLDefaults() (QSLDefaults, error) {
|
||||
keyQSLDefaultClublogStatus, keyQSLDefaultClublogCfm, keyQSLDefaultHRDLogStatus,
|
||||
keyQSLDefaultQRZComStatus, keyQSLDefaultQRZComCfm,
|
||||
keyQSLDefaultHamlogStatus, keyQSLDefaultHamlogCfm,
|
||||
keyQSLDefaultHamqthStatus,
|
||||
)
|
||||
if err != nil {
|
||||
return out, err
|
||||
@@ -10986,6 +10992,7 @@ func (a *App) GetQSLDefaults() (QSLDefaults, error) {
|
||||
out.QRZComStatus = m[keyQSLDefaultQRZComStatus]
|
||||
out.QRZComCfm = m[keyQSLDefaultQRZComCfm]
|
||||
out.HamlogStatus = m[keyQSLDefaultHamlogStatus]
|
||||
out.HamqthStatus = m[keyQSLDefaultHamqthStatus]
|
||||
out.HamlogCfm = m[keyQSLDefaultHamlogCfm]
|
||||
return out, nil
|
||||
}
|
||||
@@ -11010,6 +11017,7 @@ func (a *App) SaveQSLDefaults(d QSLDefaults) error {
|
||||
keyQSLDefaultQRZComStatus: strings.ToUpper(strings.TrimSpace(d.QRZComStatus)),
|
||||
keyQSLDefaultQRZComCfm: strings.ToUpper(strings.TrimSpace(d.QRZComCfm)),
|
||||
keyQSLDefaultHamlogStatus: strings.ToUpper(strings.TrimSpace(d.HamlogStatus)),
|
||||
keyQSLDefaultHamqthStatus: strings.ToUpper(strings.TrimSpace(d.HamqthStatus)),
|
||||
keyQSLDefaultHamlogCfm: strings.ToUpper(strings.TrimSpace(d.HamlogCfm)),
|
||||
} {
|
||||
if err := a.settings.Set(a.ctx, scope+k, v); err != nil {
|
||||
@@ -11066,6 +11074,7 @@ func applyQSLDefaultsTo(q *qso.QSO, d QSLDefaults) {
|
||||
// string field, and these two are map entries. Only set when the QSO does not
|
||||
// already carry them, which is the same rule fill() applies.
|
||||
setExtraDefault(q, hamlogSentKey, d.HamlogStatus)
|
||||
setExtraDefault(q, hamqthSentKey, d.HamqthStatus)
|
||||
setExtraDefault(q, award.HamlogQSLKey, d.HamlogCfm)
|
||||
}
|
||||
|
||||
@@ -13569,17 +13578,17 @@ func (a *App) extShouldUpload(svc extsvc.Service, id int64) bool {
|
||||
// is not remembered — hence no on-close mode and no manual backlog.
|
||||
return true
|
||||
case extsvc.ServiceHamlog:
|
||||
// The stamp is an extra, not a column — see markExtUploaded. Present means
|
||||
// it has gone, which is what stops an on-demand re-upload of a whole log
|
||||
// from sending every contact twice.
|
||||
if q.Extras != nil && strings.TrimSpace(q.Extras[hamlogSentKey]) != "" {
|
||||
// The stamp is an extra, not a column — see markExtUploaded. A stamp that
|
||||
// MEANS SENT is what stops an on-demand re-upload of a whole log from
|
||||
// sending every contact twice.
|
||||
if q.Extras != nil && extrasSaysSent(q.Extras[hamlogSentKey]) {
|
||||
applog.Printf("extsvc: QSO %d not eligible for hamlog — already sent on %s", id, q.Extras[hamlogSentKey])
|
||||
return false
|
||||
}
|
||||
return true
|
||||
case extsvc.ServiceHamQTH:
|
||||
// Same extras stamp as HAMLOG.online — ADIF names no HamQTH field.
|
||||
if q.Extras != nil && strings.TrimSpace(q.Extras[hamqthSentKey]) != "" {
|
||||
if q.Extras != nil && extrasSaysSent(q.Extras[hamqthSentKey]) {
|
||||
applog.Printf("extsvc: QSO %d not eligible for hamqth — already sent on %s", id, q.Extras[hamqthSentKey])
|
||||
return false
|
||||
}
|
||||
@@ -13608,6 +13617,22 @@ const (
|
||||
hamqthSentDateKey = "APP_OPSLOG_HAMQTH_SENT_DATE"
|
||||
)
|
||||
|
||||
// extrasSaysSent reads an extras upload stamp as "this QSO has GONE".
|
||||
//
|
||||
// Mere presence will not do. markExtUploaded writes "Y" (older builds wrote the
|
||||
// date), but the Confirmations page pre-fills the same key with a TO-DO status
|
||||
// — "R", requested, is the natural default for a service you intend to upload
|
||||
// to — and reading that as "already gone" would silently disable the very
|
||||
// auto-upload the default was set to arm. So the pending statuses mean pending,
|
||||
// and anything else means sent.
|
||||
func extrasSaysSent(v string) bool {
|
||||
switch strings.ToUpper(strings.TrimSpace(v)) {
|
||||
case "", "R", "N", "Q", "I":
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *App) markExtUploaded(svc extsvc.Service, id int64, logID string) {
|
||||
date := time.Now().UTC().Format("20060102")
|
||||
// Use a fresh background context, NOT a.ctx: this stamp often runs during
|
||||
|
||||
Reference in New Issue
Block a user