forked from ddrilling/AsbCloudServer
Fix WellOperationsStatService.GetStatClusterAsync() Add empty stat for wells with no operations
This commit is contained in:
parent
70ee22bccf
commit
6439bba779
@ -70,7 +70,6 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
var wells = await db.Wells
|
||||
.Include(w => w.WellOperations)
|
||||
.Where(w => idWells.Contains(w.Id))
|
||||
.Where(w => w.WellOperations.Any())
|
||||
.AsNoTracking()
|
||||
.ToListAsync(token);
|
||||
|
||||
@ -98,10 +97,6 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
|
||||
private async Task<StatWellDto> CalcStatWellAsync(Well well, CancellationToken token = default)
|
||||
{
|
||||
var wellOperations = well.WellOperations
|
||||
.OrderBy(o => o.DateStart)
|
||||
.ThenBy(o => o.DepthEnd);
|
||||
|
||||
var wellType = await cacheWellType.FirstOrDefaultAsync(t => t.Id == well.IdWellType, token);
|
||||
|
||||
var statWellDto = new StatWellDto()
|
||||
@ -111,6 +106,13 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
||||
WellType = wellType.Caption
|
||||
};
|
||||
|
||||
if (well.WellOperations is null)
|
||||
return statWellDto;
|
||||
|
||||
var wellOperations = well.WellOperations
|
||||
.OrderBy(o => o.DateStart)
|
||||
.ThenBy(o => o.DepthEnd);
|
||||
|
||||
if (!wellOperations.Any())
|
||||
return statWellDto;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user