From 6f0b58a3fbbc1d68fa977fdcfeebe8f2cf8d0682 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 16 Oct 2021 18:57:06 +0100 Subject: [PATCH] Improve logging Skip item if 7 day price is 0 --- .../Helpers/MarketPricesHelper.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs b/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs index 757dffc..d6b43a1 100644 --- a/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs +++ b/MarketPriceLookup.Common/Helpers/MarketPricesHelper.cs @@ -45,11 +45,21 @@ namespace MarketPriceLookup.Common.Helpers //string currency = GetCurrencyType(fields[7]); string bsgId = fields[8]; + if (avg7daysPrice == 0) + { + LoggingHelpers.LogError($"unable to add bad item with price average of 0, ignoring: {bsgId} {name}"); + continue; + } + if (priceFile.ContainsKey(bsgId)) { //oh no var existingItem = priceFile[bsgId]; - LoggingHelpers.LogError($"Item already exists: {bsgId} {name}. item that already exists: {existingItem.TemplateId} {existingItem.Name}"); + LoggingHelpers.LogError($"Unable to add item: {bsgId} {name}. existing item: {existingItem.TemplateId} {existingItem.Name}"); + if (existingItem.Average7DaysPrice != avg7daysPrice) + { + LoggingHelpers.LogError($"Price diff found: already existing item price: {existingItem.Average7DaysPrice} new item price: {avg7daysPrice}"); + } } else {