Get WAE ready: the score split, the Cabrillo layouts and the QTC list

The score summary now splits the way N1MM's does. `ContestLog` keeps a tally
per band, and per kind of row where the contest has kinds, and the score window
reads those instead of adding the rows up itself. Three things were wrong with
the old sum:

- The band rows counted a multiplier as one whatever the band. WAE weights it
  by band — `ScoreRow.AddContact` adds four on 3.5, three on 7 and two on 14,
  21 and 28 — so the band rows did not add up to the total.
- The band rows counted contacts left out of the claimed score.
- There was no split by kind. `CWAE.LogInfo` and `ScoreClass.Description` give
  WAE a `Q/QTC` column and a row per band and kind, so contacts, traffic sent
  and traffic received are read apart.

The Cabrillo writer now pads the record name to seven characters, which is what
`ConvertCabrilloStructStdToString` does and why: `X-QSO:` is six characters and
a space, so every record name puts the frequency in the same column. Nonemm
wrote five, and the `X-QSO:` lines added last commit did not line up with the
rest.

WAE's own layouts follow `CWAE.CabrilloString`: three spaces after the sent
serial rather than the one every other column gets, and the transmitter column
only for a multi-operator entry.

`QtcTraffic.ToSend` no longer offers a contact marked as a dupe, which is what
`DBSupport.QTCRecordsetCount` leaves out with `Trim(ContactType) = ''`.

Checked by running the program against a WAE SSB log of six contacts and a
series of ten received: the band rows read 4, 3, 2 and 2 and add up to the 11
in the total row.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
2026-09-09 20:25:45 +00:00
co-authored by Claude Opus 5
parent de8edafa0c
commit d4d0375f1f
11 changed files with 181 additions and 37 deletions
@@ -36,7 +36,7 @@ public class CabrilloWriterTests
{
CabrilloWriter writer = new(new CqWorldWide(ModeCategory.Cw), Me);
string line = writer.QsoLine(Contact());
Assert.StartsWith("QSO: 14025 CW 2026-05-30 1234 DL1ABC", line);
Assert.StartsWith("QSO: 14025 CW 2026-05-30 1234 DL1ABC", line);
Assert.Contains("JA1XYZ", line);
Assert.EndsWith("0", line);
Assert.Contains(" 14 ", line);
@@ -84,7 +84,7 @@ public class CabrilloWriterTests
new CabrilloHeader { Contest = "CQ-WW-CW", Callsign = "DL1ABC" },
[Contact() with { IsClaimed = false }]);
Assert.Contains("\r\nX-QSO: ", log);
Assert.DoesNotContain("\r\nQSO: ", log);
Assert.DoesNotContain("\r\nQSO:", log);
}
/// The three contests where a DX entrant sends a serial. N1MM writes the
@@ -105,6 +105,41 @@ public class CabrilloWriterTests
new CabrilloWriter(new YoDxHf(), Me).QsoLine(qso));
}
private static string WaeLine(string tag, string exchange) =>
tag.PadRight(7) + " 3799 PH 2026-05-30 1234 " + exchange;
/// WAE writes contacts and QTC traffic under different tags and in
/// different columns. N1MM's layouts are in `CWAE.CabrilloString`: a
/// contact leaves three spaces after the sent serial, and a QTC line is
/// the receiver, the series, the sender, then the time, callsign and
/// serial number of the contact being reported.
[Fact]
public void WaeWritesContactsAndTrafficUnderTheirOwnTags()
{
CabrilloWriter writer = new(new Wae(ModeCategory.Phone), Me);
Qso contact = Contact(3_799, Modes.Usb) with { SentNumber = 12, ReceivedNumber = 34 };
Assert.Equal(
WaeLine("QSO:", "DL1ABC 599 0012 JA1XYZ 599 0034 "),
writer.QsoLine(contact));
Qso sent = new WaeQtc(
Callsign.Parse("JA1XYZ"),
IsSent: true,
Series: 3,
CountInSeries: 10,
TimeUtc: "1201",
Call: Callsign.Parse("G3ABC"),
Number: 45).ApplyTo(contact);
Assert.Equal(
WaeLine("QTC:", "JA1XYZ 3/10 DL1ABC 1201 G3ABC 0045 "),
writer.QsoLine(sent));
Qso received = sent with { Exchange1 = WaeQtc.Received };
Assert.Equal(
WaeLine("QTC:", "DL1ABC 3/10 JA1XYZ 1201 G3ABC 0045 "),
writer.QsoLine(received));
}
/// The SA 10 file, whose sponsor asks for its own columns: the operator's
/// call in the first 13, then every column padded to the width the file
/// gives, with one space after it.
@@ -123,7 +158,7 @@ public class CabrilloWriterTests
string line = writer.QsoLine(Contact() with { Exchange1 = "25" });
Assert.Equal(
"QSO: 14025 CW 2026-05-30 1234 DL1ABC 599 14 JA1XYZ 599 25 ",
"QSO: 14025 CW 2026-05-30 1234 DL1ABC 599 14 JA1XYZ 599 25 ",
line);
}
@@ -153,7 +188,7 @@ public class CabrilloWriterTests
Contact(14_025, Modes.Rtty) with { MiscText = "1704", Exchange1 = "905" });
Assert.Equal(
"QSO: 14025 RY 2026-05-30 1234 "
"QSO: 14025 RY 2026-05-30 1234 "
+ "DL1ABC 599 0012 1704 "
+ "JA1XYZ 599 0034 0905 0",
line);
@@ -186,7 +221,7 @@ public class CabrilloWriterTests
string line = writer.QsoLine(Contact() with { Name = "SAM", Exchange1 = "OH" });
Assert.Equal(
"QSO: 14025 CW 2026-05-30 1234 "
"QSO: 14025 CW 2026-05-30 1234 "
+ "DL1ABC 12 JOE OH "
+ "JA1XYZ 34 SAM OH 0",
line);
@@ -209,7 +244,7 @@ public class CabrilloWriterTests
string line = writer.QsoLine(Contact() with { Name = "SAM", Exchange1 = "OH" });
Assert.Equal(
"QSO: 14025 CW 2026-05-30 1234 "
"QSO: 14025 CW 2026-05-30 1234 "
+ "DL1ABC 12 JOE OH "
+ "JA1XYZ 34 SAM OH 0",
line);
@@ -232,7 +267,7 @@ public class CabrilloWriterTests
Contact() with { Precedence = "B", Check = 77, Section = "OH" });
Assert.Equal(
"QSO: 14025 CW 2026-05-30 1234 "
"QSO: 14025 CW 2026-05-30 1234 "
+ "DL1ABC 0012 A 55 OH "
+ "JA1XYZ 0034 B 77 OH ",
line);
@@ -254,7 +289,7 @@ public class CabrilloWriterTests
string line = writer.QsoLine(Contact() with { Section = "OH" });
Assert.Equal(
"QSO: 14025 CW 2026-05-30 1234 "
"QSO: 14025 CW 2026-05-30 1234 "
+ "DL1ABC OH012 "
+ "JA1XYZ OH034 ",
line);