From 30d1df4b5e84866aa7ee1f0d1075e0fab314aa0f Mon Sep 17 00:00:00 2001 From: ilitirit Date: Wed, 7 Aug 2024 19:38:02 +0200 Subject: [PATCH] Fix stuff --- .../Consumers/DutyCompletionResultConsumer.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Expedience.Api/Consumers/DutyCompletionResultConsumer.cs b/Expedience.Api/Consumers/DutyCompletionResultConsumer.cs index 4a01b76..1896df7 100644 --- a/Expedience.Api/Consumers/DutyCompletionResultConsumer.cs +++ b/Expedience.Api/Consumers/DutyCompletionResultConsumer.cs @@ -97,14 +97,20 @@ namespace Expedience.Api.Consumers } else { - _logger.LogInformation("Territory with Id {territoryId} with name {contentName}", territory.TerritoryId, territory.ContentName); + _logger.LogInformation("Territory with Id {territoryId} with name {contentName} already exists", territory.TerritoryId, territory.ContentName); + if (String.IsNullOrWhiteSpace(territory.ContentName)) { - _logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}", - completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName); - // Update the place/content name if necessary - territory.ContentName = message.DutyInfo.ContentName; - territory.PlaceName = message.DutyInfo.PlaceName; + _logger.LogInformation("Updating territory {territoryId} content name to {contentName}", + completionResult.TerritoryId, message.DutyInfo.ContentName); + territory.ContentName = message.DutyInfo.ContentName ?? ""; + } + + if (String.IsNullOrWhiteSpace (territory.PlaceName)) + { + _logger.LogInformation("Updating territory {territoryId} place name to {placeName}", + completionResult.TerritoryId, message.DutyInfo.PlaceName); + territory.PlaceName = message.DutyInfo.PlaceName ?? ""; } }