Revert "Правка расчета сводной статистики по бурильщикам"

This reverts commit 5bf30956c8.
This commit is contained in:
Olga Nemt 2024-04-01 16:12:15 +05:00
parent 5bf30956c8
commit 27b67010d4

View File

@ -57,7 +57,7 @@ internal class SubsystemService : ISubsystemService
var result = new List<DrillerDetectedOperationStatDto>(); var result = new List<DrillerDetectedOperationStatDto>();
var schedulePage = await scheduleRepository.GetPageAsync(request, token); var schedulePage = await scheduleRepository.GetPageAsync(request, token);
var wells = await wellService.GetAsync(new WellRequest { Ids = request.IdsWells }, token); var wells = await wellService.GetAsync(new WellRequest { Ids = request.IdsWells }, token);
foreach (var schedule in schedulePage) foreach (var schedule in schedulePage)
{ {
var idWell = schedule.IdWell; var idWell = schedule.IdWell;
@ -68,15 +68,21 @@ internal class SubsystemService : ISubsystemService
var detectedOperations = await detectedOperationService var detectedOperations = await detectedOperationService
.GetOperationsAsync(byWellRequest, token); .GetOperationsAsync(byWellRequest, token);
var detectedOperationsByCurrentDriller = detectedOperations.Where(d => d.Driller?.Id == schedule.IdDriller); var groupByDriller = detectedOperations
var drillerOperationsStat = await CalcStatAsync(detectedOperationsByCurrentDriller, token); .Where(operation => operation.Driller is not null)
var dto = new DrillerDetectedOperationStatDto .GroupBy(operation => operation.Driller);
foreach (var entry in groupByDriller)
{ {
Statistic = drillerOperationsStat, var drillerOperationsStat = await CalcStatAsync(entry, token);
Schedule = schedule, var dto = new DrillerDetectedOperationStatDto
Well = well, {
}; Statistic = drillerOperationsStat,
result.Add(dto); Schedule = schedule,
Well = well,
};
result.Add(dto);
}
} }
return result; return result;