Исправление группировки по подсистемам

This commit is contained in:
eugeniy_ivanov 2022-10-25 22:18:28 +05:00
parent 17c7392542
commit 22136824ac

View File

@ -187,18 +187,18 @@ namespace AsbCloudInfrastructure.Services.Subsystems
/// <inheritdoc/>
public async Task<DatesRangeDto?> GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token)
{
{
var query = BuildQuery(request);
if (query is not null)
{
var result = await query
.GroupBy(o => o.IdSubsystem)
.Select(g => new DatesRangeDto
{
From = g.Min(o => o.DateStart).DateTime,
To = g.Max(o => o.DateEnd).DateTime
})
.FirstOrDefaultAsync(token);
.GroupBy(o => o.IdTelemetry)
.Select(g => new DatesRangeDto
{
From = g.Min(o => o.DateStart).DateTime,
To = g.Max(o => o.DateEnd).DateTime
})
.FirstOrDefaultAsync(token);
return result;
}
return null;