forked from ddrilling/AsbCloudServer
- Doc
- Fix callback test
This commit is contained in:
parent
cbfce9eefc
commit
6ab3fdadbd
@ -1,7 +1,4 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Requests;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -13,16 +10,15 @@ namespace AsbCloudApp.Services
|
||||
public interface IDataSaubStatService
|
||||
{
|
||||
/// <summary>
|
||||
/// Создание записей таблицы DataSaubStat
|
||||
/// Расчет статистики DataSaubStat
|
||||
/// </summary>
|
||||
/// <param name="gap">
|
||||
/// Количество дней, которые необходимо вычесть из текущей даты для формирования начальной даты
|
||||
/// сбора данных по телеметрии
|
||||
/// <param name="lastDaysFilter">
|
||||
/// Количество дней за которые должны были приходить данные, чтобы телеметрия попала в обработку.
|
||||
/// </param>
|
||||
/// <param name="onProgressCallback"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task CreateStatAsync(int gap, Action<string, double?> onProgressCallback, CancellationToken token);
|
||||
Task CreateStatAsync(int lastDaysFilter, Action<string, double?> onProgressCallback, CancellationToken token);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
this.detectedOperationRepository = detectedOperationRepository;
|
||||
}
|
||||
|
||||
public async Task CreateStatAsync(int gap, Action<string, double?> onProgressCallback, CancellationToken token)
|
||||
public async Task CreateStatAsync(int lastDaysFilter, Action<string, double?> onProgressCallback, CancellationToken token)
|
||||
{
|
||||
var cacheRequest = new TelemetryDataRequest()
|
||||
{
|
||||
GeDate = DateTime.UtcNow.AddDays(-gap)
|
||||
GeDate = DateTime.UtcNow.AddDays(-lastDaysFilter)
|
||||
};
|
||||
var idTelemetries = telemetryDataCache.GetIds(cacheRequest).ToArray();
|
||||
|
||||
@ -52,7 +52,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
var lastDate = stats.FirstOrDefault(s => s.IdTelemetry == idTelemetry)?.DateEnd.ToUniversalTime() ?? DateTimeOffset.UnixEpoch;
|
||||
var statsCount = await CreateStatForTelemetryFromDate(idTelemetry, lastDate, token);
|
||||
if(onProgressCallback != null)
|
||||
onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", i * 1d / idTelemetries.Length);
|
||||
onProgressCallback($"Calculate stat for telemetry: {idTelemetry}; from {lastDate}; results count: {statsCount};", 1d * i / idTelemetries.Length);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class DataSaubStatServiceTest
|
||||
{
|
||||
//assert
|
||||
Assert.NotNull(percent);
|
||||
Assert.InRange((double)percent, 0.0, 100.0);
|
||||
Assert.InRange(percent.Value, 0.0, 1.0);
|
||||
};
|
||||
|
||||
//act
|
||||
@ -309,7 +309,7 @@ public class DataSaubStatServiceTest
|
||||
{
|
||||
//assert
|
||||
Assert.NotNull(percent);
|
||||
Assert.InRange((double)percent, 0.0, 100.0);
|
||||
Assert.InRange(percent.Value, 0.0, 1.0);
|
||||
};
|
||||
|
||||
//act
|
||||
|
Loading…
Reference in New Issue
Block a user