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