From 366a10630805298a2f6ebc6f05f4076e7d484135 Mon Sep 17 00:00:00 2001 From: ujijrujijr Date: Fri, 17 May 2024 14:05:17 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GarmentFactoryFileImplement/Implements/ShopStorage.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/GarmentFactoryFileImplement/Implements/ShopStorage.cs b/GarmentFactoryFileImplement/Implements/ShopStorage.cs index fed4ced..e30ebbd 100644 --- a/GarmentFactoryFileImplement/Implements/ShopStorage.cs +++ b/GarmentFactoryFileImplement/Implements/ShopStorage.cs @@ -150,15 +150,12 @@ namespace GarmentFactoryFileImplement.Implements return false; } - foreach (Shop shop in source.Shops) + var shopsWithFreeSpace = source.Shops.Where(x => x.TextileMaxCount - x.ShopTextiles.Select(x => x.Value.Item2).Sum() > 0); + + foreach (Shop shop in shopsWithFreeSpace) { int freeSpace = shop.TextileMaxCount - shop.ShopTextiles.Select(x => x.Value.Item2).Sum(); - if (freeSpace <= 0) - { - continue; - } - freeSpace = Math.Min(freeSpace, model.Count); model.Count -= freeSpace;