diff --git a/Backend/Services/LiftService.cs b/Backend/Services/LiftService.cs index 20c9493ff3..93af0cbfc1 100644 --- a/Backend/Services/LiftService.cs +++ b/Backend/Services/LiftService.cs @@ -283,6 +283,8 @@ public async Task LiftExport(string projectId, IProjectRepository projRe // Get every word with all of its information. var allWords = await wordRepo.GetAllWords(projectId); var frontier = await wordRepo.GetAllFrontier(projectId); + // All words in the frontier with any senses are considered current. + // The Combine does not import senseless entries and the interface is supposed to prevent creating them. var activeWords = frontier.Where( x => x.Senses.Any(s => s.Accessibility == Status.Active || s.Accessibility == Status.Protected)).ToList(); var hasFlags = activeWords.Any(w => w.Flag.Active); @@ -308,11 +310,11 @@ public async Task LiftExport(string projectId, IProjectRepository projRe // Get all project speakers for exporting audio and consents. var projSpeakers = await speakerRepo.GetAllSpeakers(projectId); - // All words in the frontier with any senses are considered current. - // The Combine does not import senseless entries and the interface is supposed to prevent creating them. - // So the words found in allWords with no matching guid in activeWords are exported as 'deleted'. - var deletedWords = allWords.Where( - x => activeWords.All(w => w.Guid != x.Guid)).DistinctBy(w => w.Guid).ToList(); + // Deleted words found in allWords with no matching guid in activeWords are exported as 'deleted'. + var activeWordGuids = activeWords.Select(w => w.Guid).ToHashSet(); + var deletedWords = allWords + .Where(w => w.Accessibility == Status.Deleted && !activeWordGuids.Contains(w.Guid)) + .DistinctBy(w => w.Guid).ToList(); var englishSemDoms = await semDomRepo.GetAllSemanticDomainTreeNodes("en") ?? []; var semDomNames = englishSemDoms.ToDictionary(x => x.Id, x => x.Name);