Keep QTC traffic out of the serial numbers

A QTC row holds the serial of the contact it reports, which the station
being reported sent, not us. The serial pool was filled from every row in
the log, so reporting a station that sent us 1800 pushed our own next serial
to 1801, and reopening the log read it back from the rows again.

The pool now takes the sent number of contacts alone, when a contact is
logged, when one arrives from another station of the entry, and when the
numbers are seeded from the log at startup. N1MM leaves both QTC kinds out
of the same query, in QSONrsByBand.

The test opens a real log file, sends a series, closes the store and opens
it again, so the series numbering and the contacts already reported are
checked across a restart as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
This commit is contained in:
2026-09-10 19:30:32 +00:00
co-authored by Claude Opus 5
parent 3e326053a0
commit 265f90ccd7
2 changed files with 154 additions and 3 deletions
+16 -3
View File
@@ -111,7 +111,7 @@ public sealed class ContestSession
{
Log.Replace(stored);
}
Numbers.Record(stored.SentNumber, stored.Band);
RecordNumber(stored);
Logged?.Invoke(this, stored);
Changed?.Invoke(this, EventArgs.Empty);
return stored;
@@ -203,7 +203,7 @@ public sealed class ContestSession
}
Qso arrived = store.Add(FromNetwork(qso));
Log.Insert(arrived);
Numbers.Record(arrived.SentNumber, arrived.Band);
RecordNumber(arrived);
Changed?.Invoke(this, EventArgs.Empty);
return true;
}
@@ -274,6 +274,19 @@ public sealed class ContestSession
? Log.Qsos.Where(q =>
Contest.SessionOf(q.TimestampUtc) == Contest.SessionOf(DateTime.UtcNow))
: Log.Qsos;
Numbers.SeedFrom(counted);
Numbers.SeedFrom(counted.Where(Contest.IsContact));
}
/// The sent number of a contact, and nothing else. A WAE QTC row carries
/// the serial of the contact it reports in the same column, and that
/// number was sent by the station being reported rather than by us, so
/// taking it would push our own numbers up. N1MM leaves the QTC rows out
/// of the same query, in `QSONrsByBand`.
private void RecordNumber(Qso qso)
{
if (Contest.IsContact(qso))
{
Numbers.Record(qso.SentNumber, qso.Band);
}
}
}