This commit is contained in:
Lucio Maranta
2019-01-28 11:24:27 +01:00
parent 4ee6165706
commit 9ee805a0fa
3 changed files with 15 additions and 3 deletions
@@ -156,13 +156,22 @@ namespace Step.Database.Controllers
// Populate nks
List<DTONcShankModel> dtoShanks = GetShanks();
List<DTONcFamilyModel> dtoFamilies = GetFamilies();
// Calculate & set space occupied for each shank
foreach(var shank in dtoShanks)
{
GetShankMaxSpaceOccupied(shank.Id, out int maxRight, out int maxLeft);
// Get only families id
short[] ids = shank.ChildsTools.Select(x => x.FamilyId).ToArray();
shank.MaxRight = maxRight;
shank.MaxLeft = maxLeft;
// Get Families data
List<DTONcFamilyModel> families = dtoFamilies
.Where(x => ids.Contains(x.Id))
.ToList();
// Find max between families
shank.MaxRight = families.Max(x => x.RightSize);
shank.MaxLeft = families.Max(x => x.LeftSize);
}
return dtoShanks;