Take serial numbers from a pool the whole entry shares

Each station worked out its next number as the highest in its log plus one,
so two operators typing at the same moment both sent the same number and
one of the two contacts was wrong in the sponsor's log.

SerialNumberPool holds the highest number taken per band, which is N1MM's
QSONumbers array. A number is taken at the first character of the callsign,
as N1MM takes it, and ReserveNr tells the other stations before the contact
is worked. A number at or below one this station has used is answered with
the whole pool, N1MM's QSONRS, and the station that is behind counts on from
there. The pool also goes out when a contest is opened and when the numbers
are started again.

Contest.NumbersByBand says whether the numbers run per band or as one
sequence for the station. CQ WPX runs one per band for a multi-two and a
multi-multi; every other contest here runs one sequence. The band index in
the message is N1MM's, so the array lines up with theirs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
2026-09-10 11:56:49 +00:00
co-authored by Claude Opus 5
parent 33c7631e17
commit 7ba0b44fc1
21 changed files with 677 additions and 40 deletions
@@ -727,4 +727,64 @@ public class OperatingPositionTests
Assert.True(session.StackAnother());
Assert.False(session.RestoreWiped());
}
/// N1MM takes the serial number at the first character of the callsign, not
/// at logging, so the number is on the network while the contact is still
/// being worked. A second position takes the next one.
[Fact]
public void TypingACallTakesTheSerialNumber()
{
ContestSession shared = Shared(new FakeLogStore(), new CqWpx(ModeCategory.Cw));
OperatingPosition run = new(shared, 1);
OperatingPosition mult = new(shared, 2);
run.Entry.Call = "J";
Assert.Equal(1, run.SentNumber);
Assert.Equal(2, mult.SentNumber);
}
/// Without the pool both positions showed the same number until one of them
/// logged. The number the other station takes counts here as well.
[Fact]
public void ANumberAnotherStationTookIsNotSentHere()
{
OperatingPosition session = Session(new CqWpx(ModeCategory.Cw));
session.Session.Numbers.Note(5, Bands.Band20M);
Assert.Equal(6, session.SentNumber);
}
/// The number is held until the contact is logged, so a wipe keeps it and
/// the next contact takes a fresh one.
[Fact]
public void TheNumberIsHeldUntilTheContactIsLogged()
{
OperatingPosition session = Session(new CqWpx(ModeCategory.Cw));
session.Entry.Call = "JA1XYZ";
Assert.Equal(1, session.SentNumber);
session.Wipe();
Assert.Equal(1, session.SentNumber);
session.Entry.Call = "JA2XYZ";
session.Entry.Set(ExchangeSlot.ReceivedReport, "599");
session.Entry.Set(ExchangeSlot.SerialNumber, "12");
Assert.Equal(1, session.LogContact().SentNumber);
session.Entry.Call = "JA3XYZ";
Assert.Equal(2, session.SentNumber);
}
/// A contest without serial numbers has nothing to take.
[Fact]
public void NothingIsTakenInAContestThatSendsNoNumbers()
{
OperatingPosition session = Session();
session.Entry.Call = "JA1XYZ";
Assert.Equal(1, session.Session.Numbers.Next(Bands.Band20M));
}
}