From 295c23eea98b2718df8f848c0b8687138ff2d986 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Wed, 8 Jan 2025 15:15:45 -0500 Subject: [PATCH] Address various review comments --- .../LcmCrdt.Tests/Changes/JsonPatchChangeTests.cs | 10 ---------- .../FwLite/LcmCrdt/Changes/SetPartOfSpeechChange.cs | 1 - backend/FwLite/MiniLcm/SyncHelpers/SenseSync.cs | 1 - backend/LfClassicData/LfClassicMiniLcmApi.cs | 2 +- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/backend/FwLite/LcmCrdt.Tests/Changes/JsonPatchChangeTests.cs b/backend/FwLite/LcmCrdt.Tests/Changes/JsonPatchChangeTests.cs index 67b8a2b2f4..7a560ce676 100644 --- a/backend/FwLite/LcmCrdt.Tests/Changes/JsonPatchChangeTests.cs +++ b/backend/FwLite/LcmCrdt.Tests/Changes/JsonPatchChangeTests.cs @@ -37,14 +37,4 @@ public void NewChangeIPatchDoc_ThrowsForRemoveAtIndex() var act = () => new JsonPatchChange(Guid.NewGuid(), patch); act.Should().Throw(); } - - // TODO: Doesn't work now that Sense.PartOfSpeech is an object. Rewrite or toss? - // [Fact] - // public void NewPatchDoc_ThrowsForIndexBasedPath() - // { - // var patch = new JsonPatchDocument(); - // patch.Replace(entry => entry.Senses[0].PartOfSpeech, "noun"); - // var act = () => new JsonPatchChange(Guid.NewGuid(), patch); - // act.Should().Throw(); - // } } diff --git a/backend/FwLite/LcmCrdt/Changes/SetPartOfSpeechChange.cs b/backend/FwLite/LcmCrdt/Changes/SetPartOfSpeechChange.cs index 218fe930e5..44368b2f1e 100644 --- a/backend/FwLite/LcmCrdt/Changes/SetPartOfSpeechChange.cs +++ b/backend/FwLite/LcmCrdt/Changes/SetPartOfSpeechChange.cs @@ -12,7 +12,6 @@ public override async ValueTask ApplyChange(Sense entity, ChangeContext context) if (PartOfSpeechId is null) { entity.PartOfSpeechId = null; - entity.PartOfSpeech = null; return; } diff --git a/backend/FwLite/MiniLcm/SyncHelpers/SenseSync.cs b/backend/FwLite/MiniLcm/SyncHelpers/SenseSync.cs index 5289c3d2b9..8e3d75ac0d 100644 --- a/backend/FwLite/MiniLcm/SyncHelpers/SenseSync.cs +++ b/backend/FwLite/MiniLcm/SyncHelpers/SenseSync.cs @@ -35,7 +35,6 @@ public static async Task Sync(Guid entryId, if (beforeSense.PartOfSpeechId != afterSense.PartOfSpeechId) { - patchDocument.Replace(sense => sense.PartOfSpeech, afterSense.PartOfSpeech); patchDocument.Replace(sense => sense.PartOfSpeechId, afterSense.PartOfSpeechId); } diff --git a/backend/LfClassicData/LfClassicMiniLcmApi.cs b/backend/LfClassicData/LfClassicMiniLcmApi.cs index fe48959b42..717b1a405f 100644 --- a/backend/LfClassicData/LfClassicMiniLcmApi.cs +++ b/backend/LfClassicData/LfClassicMiniLcmApi.cs @@ -173,7 +173,7 @@ private async IAsyncEnumerable Query(QueryOptions? options = null, string await foreach (var entry in Entries.Aggregate(pipeline).ToAsyncEnumerable()) { - yield return await ToEntry(entry); // TODO: Is there a way to turn this into a .Select()? Because "yield return await" looks a little unwieldy + yield return await ToEntry(entry); } }