From e48a485053f981dbc92dcf7d1a6741bd36cc14d6 Mon Sep 17 00:00:00 2001
From: Jebzou <22751386+Jebzou@users.noreply.github.com>
Date: Sat, 7 Dec 2024 18:11:03 +0100
Subject: [PATCH] Ignore finished plan for upgrades
---
.../EquipmentUpgradePlanner/EquipmentUpgradePlanManager.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ElectronicObserver/Window/Tools/EquipmentUpgradePlanner/EquipmentUpgradePlanManager.cs b/ElectronicObserver/Window/Tools/EquipmentUpgradePlanner/EquipmentUpgradePlanManager.cs
index 019233b6c..150d54f1c 100644
--- a/ElectronicObserver/Window/Tools/EquipmentUpgradePlanner/EquipmentUpgradePlanManager.cs
+++ b/ElectronicObserver/Window/Tools/EquipmentUpgradePlanner/EquipmentUpgradePlanManager.cs
@@ -193,15 +193,16 @@ private void UpdatePlanAfterEquipmentImprovement(EquipmentUpgradePlanItemViewMod
/// Null if not found
private EquipmentUpgradePlanItemViewModel? FindEquipmentPlanFromEquipmentData(IEquipmentData equipmentData)
{
- EquipmentUpgradePlanItemViewModel? foundPlan = PlannedUpgrades.FirstOrDefault(plan => plan.Equipment?.MasterID == equipmentData.MasterID);
+ List plans = PlannedUpgrades.Where(plan => !plan.Finished).ToList();
+
+ EquipmentUpgradePlanItemViewModel? foundPlan = plans.FirstOrDefault(plan => plan.Equipment?.MasterID == equipmentData.MasterID);
// Plan found, return it
if (foundPlan != null) return foundPlan;
// Not found => look for a matching plan
- foundPlan = PlannedUpgrades
+ foundPlan = plans
.Where(plan => plan.Equipment?.MasterID == 0)
- .Where(plan => !plan.Finished)
.Where(plan => plan.DesiredUpgradeLevel is UpgradeLevel.Conversion || plan.DesiredUpgradeLevel > equipmentData.UpgradeLevel)
.FirstOrDefault(plan => plan.Equipment?.EquipmentID == equipmentData.EquipmentID);