Enhance UI, add AI integration, improve logging and database stats
This commit is contained in:
@@ -151,14 +151,14 @@ public class TradeHistoryWorker : BackgroundService
|
||||
|
||||
if (newTrades.Count > 0)
|
||||
{
|
||||
var uniqueNewTrades = newTrades.GroupBy(tr => tr.PlatformTradeId).Select(g => g.First()).ToList();
|
||||
var uniqueNewTrades = newTrades.GroupBy(tr => tr.PlatformTradeId, StringComparer.OrdinalIgnoreCase).Select(g => g.First()).ToList();
|
||||
try {
|
||||
await tradeRepo.AddRangeAsync(uniqueNewTrades, ct);
|
||||
_statsService.TrackTradeActivity(trader.Platform, uniqueNewTrades.Count);
|
||||
trader.TotalTrades += uniqueNewTrades.Count;
|
||||
_logger.LogInformation("{Trader}: {New} new trades imported", trader.DisplayName, uniqueNewTrades.Count);
|
||||
} catch (Exception ex) when (ex.ToString().Contains("Duplicate entry")) {
|
||||
_logger.LogWarning("{Trader}: Skipping batch due to duplicates", trader.DisplayName);
|
||||
} catch (Exception ex) when (ex.ToString().Contains("Duplicate entry") || (ex.InnerException?.Message.Contains("Duplicate entry") ?? false)) {
|
||||
_statsService.TrackDuplicateError(trader.Platform, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user