Put the contacts of the last 20 minutes on the bandmap as local spots

A contest opening and contacts arriving from the other stations, a
resync included, spot the contacts logged in the last few minutes (a
setting on the telnet Filters tab, 0 for none). A station the bandmap
already holds on that band keeps its spot. Nothing is sent out. Spots
that come from the log are drawn in italics.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 12:27:55 +00:00
co-authored by Claude Sonnet 5.5
parent cf39b5af9c
commit 7c25816b74
5 changed files with 56 additions and 3 deletions
+30
View File
@@ -346,6 +346,7 @@ public sealed partial class AppSession : IDisposable
Logging.Edited += (_, change) =>
_ = link?.SendEditedAsync(change.Qso, change.OldCall, change.OldTimestampUtc);
Logging.Deleted += (_, qso) => _ = link?.SendDeletedAsync(qso);
SpotRecentContacts(Logging.Log.Qsos);
Check = new CheckWindowSources(positions[0], Calls, Bandmap);
Available = new AvailableStations(positions[0], Bandmap);
Save(Settings with { ContestNumber = contestNumber });
@@ -663,6 +664,7 @@ public sealed partial class AppSession : IDisposable
// a run of new contacts is applied before the update that follows
// it, because that update may be a clear or an edit of one of them
Logging.AddRangeFromNetwork(logged);
SpotRecentContacts(logged);
logged.Clear();
switch (update)
{
@@ -678,6 +680,34 @@ public sealed partial class AppSession : IDisposable
}
}
Logging.AddRangeFromNetwork(logged);
SpotRecentContacts(logged);
}
/// Puts the contacts of the last few minutes on the bandmap as local spots,
/// so a restart does not lose the stations just worked. A station the
/// bandmap already holds on that band keeps its spot. Nothing is sent to
/// the other stations or the cluster.
private void SpotRecentContacts(IEnumerable<Qso> contacts)
{
if (Settings.RecentContactSpotMinutes <= 0)
{
return;
}
DateTime since = DateTime.UtcNow - TimeSpan.FromMinutes(Settings.RecentContactSpotMinutes);
HashSet<(string, Band?)> held = [.. Bandmap.All().Select(s => (s.Call.Text, s.Band))];
List<Spot> spots = [];
foreach (Qso qso in contacts.Where(q => q.TimestampUtc >= since && Logging!.Contest.IsContact(q)))
{
Spot spot = new(qso.Call, qso.Frequency, qso.TimestampUtc, SpotSource.Log);
if (held.Add((spot.Call.Text, spot.Band)))
{
spots.Add(spot);
}
}
if (spots.Count > 0)
{
Bandmap.AddRange(spots);
}
}
/// Starts, restarts or stops the keyer, following what the settings say.