forked from ddrilling/AsbCloudServer
Fix operations order
This commit is contained in:
parent
cb1ab8c842
commit
1bf746dff2
@ -88,7 +88,10 @@ namespace AsbCloudInfrastructure.Services
|
||||
.AsNoTracking()
|
||||
.ToListAsync(token);
|
||||
|
||||
var operations = wells.SelectMany(w => w.WellOperations).OrderBy(o => o.StartDate);
|
||||
var operations = wells
|
||||
.SelectMany(w => w.WellOperations)
|
||||
.OrderBy(o => o.StartDate)
|
||||
.ThenBy(o => o.WellDepth);
|
||||
|
||||
var cluster = await cacheCluster.FirstOrDefaultAsync(c => c.Id == idCluster, token);
|
||||
|
||||
@ -117,6 +120,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
var operations = await db.WellOperations
|
||||
.Where(o => o.IdWell == idWell)
|
||||
.OrderBy(o => o.StartDate) // ускорит дальнейшие сортировки
|
||||
.ThenBy(o => o.WellDepth)
|
||||
.AsNoTracking()
|
||||
.ToListAsync(token);
|
||||
|
||||
@ -348,17 +352,20 @@ namespace AsbCloudInfrastructure.Services
|
||||
.Include(o => o.WellSectionType)
|
||||
.Where(o => o.IdWell == idWell)
|
||||
.OrderBy(o => o.StartDate)
|
||||
.ThenBy(o => o.WellDepth)
|
||||
.AsNoTracking()
|
||||
.ToListAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var wellOperationsPlan = wellOperations
|
||||
.Where(o => o.IdType == idOperationTypePlan)
|
||||
.OrderBy(o => o.StartDate);
|
||||
.OrderBy(o => o.StartDate)
|
||||
.ThenBy(o => o.WellDepth);
|
||||
|
||||
var wellOperationsFact = wellOperations
|
||||
.Where(o => o.IdType == idOperationTypeFact)
|
||||
.OrderBy(o => o.StartDate);
|
||||
.OrderBy(o => o.StartDate)
|
||||
.ThenBy(o => o.WellDepth);
|
||||
|
||||
if (!wellOperationsPlan.Any())
|
||||
return null;
|
||||
@ -481,7 +488,9 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
if (operations.Any())
|
||||
{
|
||||
var sortedOperations = operations.OrderBy(o => o.StartDate);
|
||||
var sortedOperations = operations
|
||||
.OrderBy(o => o.StartDate)
|
||||
.ThenBy(o => o.WellDepth);
|
||||
var count = operations.Count();
|
||||
ops = new List<OperationParams>(count);
|
||||
var item = operations.ElementAt(0);
|
||||
|
Loading…
Reference in New Issue
Block a user