A real record from their export settles it: <CALL:4>RL6M … <CNTY:5>RO-19 <APP_HAMLOG_R150COUNTRY:6>Russia <APP_HAMLOG_QSO_CFM:1>Y The confirmation lives in APP_HAMLOG_QSO_CFM. The four names guessed before a file was available — APP_HAMLOG_QSL and friends — were all wrong, which is the argument for reading one rather than reasoning about it. So that becomes the canonical key everywhere: the award source, the row colours, the grid column and the bulk editor. Importing a log downloaded from HAMLOG now carries its confirmations into OpsLog with nothing to rename. The older names, including the APP_OPSLOG_HAMLOG_QSL that OpsLog itself wrote in the meantime, are still honoured on read so nothing already stamped stops counting.
53 lines
2.1 KiB
Go
53 lines
2.1 KiB
Go
package qso
|
|
|
|
import "testing"
|
|
|
|
// Mode, submode and RST are repair fields: an import that mapped every contact
|
|
// to SSB, or an ADIF that carried no MODE, is fixed in one pass instead of one
|
|
// row at a time. They were excluded as "per-QSO", which confused describing a
|
|
// QSO with repairing a batch of them.
|
|
func TestModeAndRSTAreBulkEditable(t *testing.T) {
|
|
for _, col := range []string{"mode", "submode", "rst_sent", "rst_rcvd"} {
|
|
if !bulkEditableCols[col] {
|
|
t.Errorf("%s should be bulk-editable", col)
|
|
}
|
|
}
|
|
}
|
|
|
|
// Band must NOT be bulk-editable on its own: it travels with the frequency
|
|
// through BulkSetFrequency. A band contradicting its own frequency is invalid
|
|
// ADIF, and every export would carry the contradiction out into the world.
|
|
func TestBandIsNotBulkEditableAlone(t *testing.T) {
|
|
for _, col := range []string{"band", "freq_hz", "callsign", "qso_date"} {
|
|
if bulkEditableCols[col] {
|
|
t.Errorf("%s must not be bulk-editable on its own", col)
|
|
}
|
|
}
|
|
}
|
|
|
|
// A log uploaded to HAMLOG.online BY HAND has to be markable afterwards, or
|
|
// OpsLog offers to send every one of those contacts again. Both directions live
|
|
// in extras — the ADIF names a field for hamlog.EU and none for hamlog.ONLINE —
|
|
// so they must be reachable through the extras path, not the column one.
|
|
func TestHamlogFieldsAreBulkEditable(t *testing.T) {
|
|
for field, want := range map[string]string{
|
|
"hamlog_sent": "APP_OPSLOG_HAMLOG_SENT",
|
|
"hamlog_sent_date": "APP_OPSLOG_HAMLOG_SENT_DATE",
|
|
// Their field name — see award.HamlogQSLKey. Editing it by hand and
|
|
// importing their ADIF must land in the SAME place.
|
|
"hamlog_rcvd": "APP_HAMLOG_QSO_CFM",
|
|
"hamlog_rcvd_date": "APP_OPSLOG_HAMLOG_QSL_DATE",
|
|
} {
|
|
if got := BulkExtraKey(field); got != want {
|
|
t.Errorf("BulkExtraKey(%q) = %q, want %q", field, got, want)
|
|
}
|
|
}
|
|
// And they are NOT columns: a mapping that also claimed a column would write
|
|
// to a table that has none.
|
|
for _, col := range []string{"hamlog_sent", "hamlog_rcvd", "APP_OPSLOG_HAMLOG_SENT"} {
|
|
if BulkEditable(col) {
|
|
t.Errorf("%q is offered as a bulk-editable COLUMN", col)
|
|
}
|
|
}
|
|
}
|