forked from ddrilling/AsbCloudServer
Фильтр статистики по дате, а не по глубине
This commit is contained in:
parent
08e0a4fb38
commit
0f93c637e0
@ -1,4 +1,5 @@
|
||||
using AsbCloudApp.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -14,11 +15,11 @@ namespace AsbCloudApp.Repositories
|
||||
/// Получение записей по ключу телеметрии
|
||||
/// </summary>
|
||||
/// <param name="idTelemetry">ключ телеметрии</param>
|
||||
/// <param name="geDepth">начальная глубина</param>
|
||||
/// <param name="leDepth">конечная глубина</param>
|
||||
/// <param name="geDate">начальная дата</param>
|
||||
/// <param name="leDate">конечная дата</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, double geDepth, double leDepth, CancellationToken token);
|
||||
Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение последних по дате окончания бурения записей в разрезе телеметрий
|
||||
|
@ -40,14 +40,14 @@ namespace AsbCloudInfrastructure.Repository
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, double geDepth, double leDepth, CancellationToken token)
|
||||
public async Task<IEnumerable<DataSaubStatDto>> GetAsync(int idTelemetry, DateTimeOffset geDate, DateTimeOffset leDate, CancellationToken token)
|
||||
{
|
||||
var timeSpan = TimeSpan.FromHours(telemetryService.GetTimezone(idTelemetry).Hours);
|
||||
|
||||
var stats = await db.Set<DataSaubStat>()
|
||||
.Where(s => s.IdTelemetry == idTelemetry)
|
||||
.Where(s => s.DepthStart >= geDepth)
|
||||
.Where(s => s.DepthEnd <= leDepth)
|
||||
.Where(s => s.DateStart >= geDate)
|
||||
.Where(s => s.DateEnd <= leDate)
|
||||
.ToArrayAsync(token);
|
||||
|
||||
var result = stats.Select(s => ConvertToDto(s, timeSpan));
|
||||
|
@ -67,8 +67,10 @@ namespace AsbCloudInfrastructure.Services.ProcessMaps.Report
|
||||
if (!wellOperations.Any())
|
||||
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
|
||||
|
||||
var geDate = wellOperations.Min(p => p.DateStart).ToUniversalTime();
|
||||
var leDate = wellOperations.Max(p => (p.DateStart.AddHours(p.DurationHours))).ToUniversalTime();
|
||||
var dataSaubStats =
|
||||
(await dataSaubStatRepository.GetAsync(well.IdTelemetry.Value, geDepth, leDepth, token)).ToArray();
|
||||
(await dataSaubStatRepository.GetAsync(well.IdTelemetry.Value, geDate, leDate, token)).ToArray();
|
||||
|
||||
if (!dataSaubStats.Any())
|
||||
return Enumerable.Empty<ProcessMapReportDataSaubStatDto>();
|
||||
|
Loading…
Reference in New Issue
Block a user