forked from ddrilling/AsbCloudServer
Fix WellOperationService.GetOperationsAsync exception by call Min on empty collection
This commit is contained in:
parent
ba0eaa8014
commit
cc8a4fa200
@ -106,7 +106,7 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
|||||||
Take = take,
|
Take = take,
|
||||||
Count = await query.CountAsync(token).ConfigureAwait(false),
|
Count = await query.CountAsync(token).ConfigureAwait(false),
|
||||||
};
|
};
|
||||||
var dateStart = query.Min(o => o.DateStart);
|
|
||||||
query = query
|
query = query
|
||||||
.OrderBy(e => e.DateStart)
|
.OrderBy(e => e.DateStart)
|
||||||
.ThenBy(e => e.DepthEnd)
|
.ThenBy(e => e.DepthEnd)
|
||||||
@ -118,8 +118,12 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
|||||||
var entities = await query.Take(take).AsNoTracking()
|
var entities = await query.Take(take).AsNoTracking()
|
||||||
.ToListAsync(token).ConfigureAwait(false);
|
.ToListAsync(token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (!entities.Any())
|
||||||
|
return result;
|
||||||
|
|
||||||
var nptHours = 0d;
|
var nptHours = 0d;
|
||||||
|
|
||||||
|
var dateStart = query.Min(o => o.DateStart);
|
||||||
foreach (var entity in entities)
|
foreach (var entity in entities)
|
||||||
{
|
{
|
||||||
var dto = entity.Adapt<WellOperationDto>();
|
var dto = entity.Adapt<WellOperationDto>();
|
||||||
@ -287,8 +291,6 @@ namespace AsbCloudInfrastructure.Services.WellOperationService
|
|||||||
.Include(s => s.OperationCategory)
|
.Include(s => s.OperationCategory)
|
||||||
.Where(s => s.IdWell == idWell);
|
.Where(s => s.IdWell == idWell);
|
||||||
|
|
||||||
var dateStart = query.Min(o => o.DateStart);
|
|
||||||
|
|
||||||
if (operationType.HasValue)
|
if (operationType.HasValue)
|
||||||
query = query.Where(e => e.IdType == operationType.Value);
|
query = query.Where(e => e.IdType == operationType.Value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user