Give the network status window N1MM's tabs and columns
The window was one flat table of columns this program made up. N1MM's has tabs and a fixed set of columns, and an operator who knows one has to be able to read the other. **The window** now has Stations, Actions and Messages. Stations is a grid with N1MM's headers in N1MM's order — Computer, IP Address, Pass, Run, 10, 100, Freq, Op, Msg, Send, Receive, Band, R/M, Mode — and a row per station, this computer included. Right-click a row to pass the contact being worked to that station, to talk, to show the connection log, or to close and open its connection. Actions holds the talk line, the pass frequency, the echo and the networking switch; Messages holds the chat, the connection failures, the echo round trips and a trace of every message that arrives. **`STATUS`** is what fills those columns. N1MM sends it every few seconds whether anything has changed or not — the pass frequency, the frequency, run or search and pounce, the operator, the rates over the last ten and the last hundred contacts, the mode, the categories and the version — so a station sitting on one frequency for an hour still has a current row. `BANDMAP` only says a station moved. The five transmit-interlock flags are sent as false: this program does not block a transmitter. **`Rates.PerHour`** reads the two rate columns out of the log. Count back over the last N contacts, stop at a gap longer than the contest's minimum off time, and treat a span under a minute as a minute, so three contacts in five seconds read as 180 an hour rather than 2160. A connection closed by hand stays closed. Without that flag the next beacon opens it again within ten seconds, which makes the menu item look broken. Left out, because there is nothing behind them: N1MM's Resynchronize and Rescore tabs, the transmit interlocks of its Options tab, the Master column and the call-stacking target tab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PdAYHcdRktqKry7nk414TU
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
/// Contacts an hour, as the network status window and the score window show
|
||||
/// them.
|
||||
public class RatesTests
|
||||
{
|
||||
private static readonly DateTime Now = new(2026, 5, 30, 12, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
private static readonly TimeSpan Off = TimeSpan.FromMinutes(30);
|
||||
|
||||
private static Qso MinutesAgo(int minutes) =>
|
||||
TestLog.Contact("OM3XYZ") with { TimestampUtc = Now.AddMinutes(-minutes) };
|
||||
|
||||
/// Ten contacts spread over the last ten minutes: the oldest of them was
|
||||
/// ten minutes ago, so the rate is ten in a sixth of an hour.
|
||||
[Fact]
|
||||
public void TheRateIsTheContactsOverTheTimeTheyTook()
|
||||
{
|
||||
List<Qso> log = [.. Enumerable.Range(1, 10).Select(MinutesAgo)];
|
||||
|
||||
Assert.Equal(60, Rates.PerHour(log, 10, Now, Off));
|
||||
}
|
||||
|
||||
/// Only the last `count` contacts count, whatever else is in the log.
|
||||
[Fact]
|
||||
public void OlderContactsThanTheWindowAreLeftOut()
|
||||
{
|
||||
List<Qso> log = [.. Enumerable.Range(1, 40).Select(MinutesAgo)];
|
||||
|
||||
Assert.Equal(60, Rates.PerHour(log, 10, Now, Off));
|
||||
}
|
||||
|
||||
/// A gap as long as the contest's minimum off time ends the count.
|
||||
[Fact]
|
||||
public void CountingStopsAtATimeOffGap()
|
||||
{
|
||||
List<Qso> log = [MinutesAgo(1), MinutesAgo(2), MinutesAgo(90), MinutesAgo(91)];
|
||||
|
||||
// two contacts in the last two minutes, floored at a minute
|
||||
Assert.Equal(60, Rates.PerHour(log, 10, Now, Off));
|
||||
}
|
||||
|
||||
/// Under ten contacts the span counts as at least a minute, so a burst does
|
||||
/// not read as thousands an hour.
|
||||
[Fact]
|
||||
public void AShortBurstIsFlooredAtAMinute()
|
||||
{
|
||||
List<Qso> log = [MinutesAgo(0), MinutesAgo(0), MinutesAgo(0)];
|
||||
|
||||
Assert.Equal(180, Rates.PerHour(log, 10, Now, Off));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnEmptyLogIsNoRate() =>
|
||||
Assert.Equal(0, Rates.PerHour([], 10, Now, Off));
|
||||
|
||||
/// A station that has worked nobody since the gap has no rate, even with a
|
||||
/// full log behind it.
|
||||
[Fact]
|
||||
public void NothingSinceTheGapIsNoRate()
|
||||
{
|
||||
List<Qso> log = [.. Enumerable.Range(60, 20).Select(MinutesAgo)];
|
||||
|
||||
Assert.Equal(0, Rates.PerHour(log, 10, Now, Off));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user