CP-41573: Improve comparison logic for problems

Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
Danilo Del Busso 2023-05-19 09:34:20 +01:00 committed by Konstantina Chremmou
parent f707b0daca
commit 5f5695057d
2 changed files with 4 additions and 4 deletions

View File

@ -104,7 +104,7 @@ namespace XenAdmin.Diagnostics.Problems
result = string.Compare(Title, other.Title, StringComparison.InvariantCulture); result = string.Compare(Title, other.Title, StringComparison.InvariantCulture);
if (result == 0 && Check?.XenObjects != null && other.Check?.XenObjects != null) if (result == 0 && Check?.XenObjects != null && other.Check?.XenObjects != null)
result = Check.XenObjects.Count.CompareTo(other.Check.XenObjects.Count); result = Check.XenObjects.SequenceEqual(other.Check.XenObjects) ? 0 : Check.XenObjects.Count.CompareTo(other.Check.XenObjects.Count);
return result; return result;
} }

View File

@ -230,10 +230,10 @@ namespace XenAdmin.Wizards.PatchingWizard
if (problem is HostNotLive) if (problem is HostNotLive)
{ {
// this host is no longer live -> remove all previous problems regarding this host // this host is no longer live -> remove all previous problems regarding this host
Problem curProblem = problem; var curProblem = problem;
ProblemsResolvedPreCheck.RemoveAll(p => ProblemsResolvedPreCheck.RemoveAll(p =>
p.Check?.XenObjects != null && p.Check.XenObjects.Count > 0 && p.Check?.XenObjects != null &&
curProblem.Check?.XenObjects != null && curProblem.Check.XenObjects.Count > 0 && curProblem.Check?.XenObjects != null &&
p.Check.XenObjects.SequenceEqual(curProblem.Check.XenObjects) p.Check.XenObjects.SequenceEqual(curProblem.Check.XenObjects)
); );
} }