Исправление неправильного цикла

This commit is contained in:
Кашин Максим 2023-05-02 21:58:05 +04:00
parent 5cfafad105
commit 3136b7bd04

View File

@ -35,7 +35,6 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
public List<ReportReinforcedComponentViewModel> GetReinforcedComponents()
{
var components = _componentStorage.GetFullList();
var reinforceds = _reinforcedStorage.GetFullList();
var list = new List<ReportReinforcedComponentViewModel>();
foreach (var reinforced in reinforceds)
@ -46,13 +45,10 @@ namespace PrecastConcretePlantBusinessLogic.BusinessLogic
Components = new List<(string Component, int Count)>(),
TotalCount = 0
};
foreach (var component in components)
foreach (var component in reinforced.ReinforcedComponents)
{
if (reinforced.ReinforcedComponents.ContainsKey(component.Id))
{
record.Components.Add(new(component.ComponentName, reinforced.ReinforcedComponents[component.Id].Item2));
record.TotalCount += reinforced.ReinforcedComponents[component.Id].Item2;
}
record.Components.Add(new(component.Value.Item1.ComponentName, component.Value.Item2));
record.TotalCount += component.Value.Item2;
}
list.Add(record);
}