Add more logging

main
ilitirit 1 year ago
parent d9f08a67a0
commit 6105062500

@ -78,6 +78,9 @@ namespace Expedience.Api.Consumers
} }
// Insert this territory if it does not exist // Insert this territory if it does not exist
_logger.LogInformation("Checking if territory {territoryId} - {contentName} exists",
completionResult.TerritoryId, message.DutyInfo.ContentName);
var territory = dbContext.Territories.FirstOrDefault(t => t.TerritoryId == completionResult.TerritoryId); var territory = dbContext.Territories.FirstOrDefault(t => t.TerritoryId == completionResult.TerritoryId);
if (territory == null) if (territory == null)
{ {
@ -92,15 +95,18 @@ namespace Expedience.Api.Consumers
Level = 0, Level = 0,
}); });
} }
else if (String.IsNullOrWhiteSpace(territory.ContentName)) else
{
_logger.LogInformation("Territory with Id {territoryId} with name {contentName}", territory.TerritoryId, territory.ContentName);
if (String.IsNullOrWhiteSpace(territory.ContentName))
{ {
_logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}", _logger.LogInformation("Updating territory {territoryId} with content name {contentName} and place name {placeName}",
completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName); completionResult.TerritoryId, message.DutyInfo.ContentName, message.DutyInfo.PlaceName);
// Update the place/content name if necessary // Update the place/content name if necessary
territory.ContentName = message.DutyInfo.ContentName; territory.ContentName = message.DutyInfo.ContentName;
territory.PlaceName = message.DutyInfo.PlaceName; territory.PlaceName = message.DutyInfo.PlaceName;
} }
}
await dbContext.SaveChangesAsync(); await dbContext.SaveChangesAsync();

Loading…
Cancel
Save