Edit and delete contacts in the log
Double-click a cell in the log window to change it. The columns follow the contest exchange instead of being fixed in the XAML, so CQ WW gets a Zone column and Sweepstakes gets Nr, Prec, Ck and Sec. QsoEditor holds the column list and applies one field edit. Validation comes from the ExchangeFieldKind the contest declared: a CQ zone is 1 to 40, an ITU zone 1 to 90, a section is looked up in the ARRL list, a grid must parse. A refused edit returns the reason and leaves the log alone, so the cell reverts. Changing the callsign runs the country lookup again. Delete, or the right-click menu, removes the selected contact after a confirmation. Either way the log is rescored, so a multiplier the removed contact held passes to the next contact that claims it. Both go out to the other stations in N1MM's own messages: contactreplace carries oldcall and oldtimestamp, contactdelete names the contact. An incoming edit or delete is matched by contact id first, falling back to call plus timestamp because N1MM does not know our ids. Country, continent and the two prefixes were filled in twice, once when logging and once when editing. They now come from CountryFields. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,12 +24,14 @@ public class ContactMessageTests
|
||||
IsRunQso = true,
|
||||
};
|
||||
|
||||
private static Qso ReadBack(string xml) =>
|
||||
Assert.IsType<ContactLogged>(ContactMessage.Read(xml)).Qso;
|
||||
|
||||
[Fact]
|
||||
public void ContactSurvivesTheRoundTrip()
|
||||
{
|
||||
Qso? read = ContactMessage.Read(ContactMessage.Write(Contact(), "DL1ABC", "PC1"));
|
||||
Qso read = ReadBack(ContactMessage.Write(Contact(), "DL1ABC", "PC1"));
|
||||
|
||||
Assert.NotNull(read);
|
||||
Assert.Equal("0123456789abcdef0123456789abcdef", read.Id);
|
||||
Assert.Equal("JA1XYZ", read.Call.Text);
|
||||
Assert.Equal(14_025_500, read.Frequency.Hertz);
|
||||
@@ -44,12 +46,39 @@ public class ContactMessageTests
|
||||
/// the sender put in the field.
|
||||
[Fact]
|
||||
public void AContactFromTheNetworkIsNotOriginal() =>
|
||||
Assert.False(ContactMessage.Read(ContactMessage.Write(Contact(), "DL1ABC", "PC1"))!.IsOriginal);
|
||||
Assert.False(ReadBack(ContactMessage.Write(Contact(), "DL1ABC", "PC1")).IsOriginal);
|
||||
|
||||
[Fact]
|
||||
public void FrequenciesAreSentInUnitsOfTenHertz() =>
|
||||
Assert.Contains("<rxfreq>1402550</rxfreq>", ContactMessage.Write(Contact(), "DL1ABC", "PC1"));
|
||||
|
||||
[Fact]
|
||||
public void AnEditCarriesTheCallAndTimeTheContactHadBefore()
|
||||
{
|
||||
Qso edited = Contact() with { Call = Callsign.Parse("JA1XYZ/2") };
|
||||
DateTime before = new(2026, 5, 30, 12, 30, 0, DateTimeKind.Utc);
|
||||
|
||||
ContactReplaced read = Assert.IsType<ContactReplaced>(ContactMessage.Read(
|
||||
ContactMessage.WriteReplace(edited, "DL1ABC", "PC1", "JA1XYZ", before)));
|
||||
|
||||
Assert.Equal("JA1XYZ/2", read.Qso.Call.Text);
|
||||
Assert.Equal("JA1XYZ", read.OldCall);
|
||||
Assert.Equal(before, read.OldTimestampUtc);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ADeleteNamesTheContactByIdCallAndTime()
|
||||
{
|
||||
ContactDeleted read = Assert.IsType<ContactDeleted>(ContactMessage.Read(
|
||||
ContactMessage.WriteDelete(Contact(), "DL1ABC", "PC1")));
|
||||
|
||||
Assert.Equal("0123456789abcdef0123456789abcdef", read.Id);
|
||||
Assert.Equal("JA1XYZ", read.Call);
|
||||
Assert.Equal(new DateTime(2026, 5, 30, 12, 34, 56, DateTimeKind.Utc), read.TimestampUtc);
|
||||
Assert.Equal(3, read.ContestNumber);
|
||||
Assert.Equal("PC1", read.StationName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("<radioinfo><app>N1MM</app></radioinfo>")]
|
||||
[InlineData("not xml at all")]
|
||||
|
||||
Reference in New Issue
Block a user