diff --git a/Backend/Services/LiftService.cs b/Backend/Services/LiftService.cs index 74ef22ebd6..95aa64cc89 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,13 +310,13 @@ 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).DistinctBy(w => w.Guid) + .Where(x => !activeWordGuids.Contains(x.Guid)).ToList(); var englishSemDoms = await semDomRepo.GetAllSemanticDomainTreeNodes("en") ?? []; var semDomNames = englishSemDoms.ToDictionary(x => x.Id, x => x.Name); + foreach (var wordEntry in activeWords) { var id = MakeSafeXmlAttribute(wordEntry.Vernacular) + "_" + wordEntry.Guid;