From 6388058ba43ffe51e58ec83706eacc013a2df18a Mon Sep 17 00:00:00 2001 From: Ivan Vukman Date: Mon, 11 Sep 2023 22:22:36 +0200 Subject: [PATCH] Fix importer --- .../WikiDataImport/ImportCelebritiesPageJob.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/AnagramSolver/BackgroundJobs/WikiDataImport/ImportCelebritiesPageJob.cs b/src/AnagramSolver/BackgroundJobs/WikiDataImport/ImportCelebritiesPageJob.cs index 0d09672..77df190 100644 --- a/src/AnagramSolver/BackgroundJobs/WikiDataImport/ImportCelebritiesPageJob.cs +++ b/src/AnagramSolver/BackgroundJobs/WikiDataImport/ImportCelebritiesPageJob.cs @@ -38,14 +38,15 @@ public async Task ImportAsync(int importPageRequestId) var wikiDataCelebrities = await _httpClient.GetCelebritiesPageAsync(occupationId, nationalityId, limit, offset); - var celebrities = wikiDataCelebrities!.Results!.Bindings.Select(x => new Celebrity(x.ItemLabel.Value) - { - PhotoUrl = x.Image?.Value, - WikipediaUrl = x.WikipediaLink?.Value, - }) - .DistinctBy(x => x.FullName.ToLower(new CultureInfo("en-US"))) - .Where(x => !string.IsNullOrWhiteSpace(x.FullName.ToRemovedPunctuation().ToRemovedWhitespace())) - .ToList(); + var celebrities = wikiDataCelebrities!.Results!.Bindings + .Where(x => !string.IsNullOrWhiteSpace(x.ItemLabel.Value.ToRemovedWhitespace().ToRemovedPunctuation())) + .Select(x => new Celebrity(x.ItemLabel.Value) + { + PhotoUrl = x.Image?.Value, + WikipediaUrl = x.WikipediaLink?.Value, + }) + .DistinctBy(x => x.FullName.ToLower(new CultureInfo("en-US"))) + .ToList(); var celebrityNames = celebrities.Select(x => x.FullName.ToLower(new CultureInfo("en-US"))).ToList();