mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-12-06 00:02:34 +01:00
AccountInfo history statistics query
This commit is contained in:
1 parent
ec8f434f42
commit
758aa10e55
18 files changed
+522
-28
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WotBlitzStatisticsPro.Logic.AccountInformationPipeline.OperationContext;
|
||||
using WotBlitzStatisticsPro.Logic.Pipeline;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
||||
{
|
||||
public class CheckIfHistoryIsEmptyOperation : IOperation<IOperationContext>
|
||||
{
|
||||
private readonly ILogger<CheckIfHistoryIsEmptyOperation> _logger;
|
||||
|
||||
public CheckIfHistoryIsEmptyOperation(ILogger<CheckIfHistoryIsEmptyOperation> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
public Task Invoke(IOperationContext context, Func<IOperationContext, Task> next)
|
||||
{
|
||||
var contextData = context.Get<IStatisticsPipelineData>();
|
||||
|
||||
if (contextData.History == null ||
|
||||
contextData.History.Length == 0)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
$"History request doesn't return any data");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
return next.Invoke(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user