Fix for problem items also showing up in pending items

This commit is contained in:
Greg Neagle
2020-09-02 16:29:12 -07:00
parent c346a2833d
commit cfe2702ae2
@@ -1141,21 +1141,31 @@ func optionalItem(forName name: String) -> OptionalItem? {
}
func getOptionalWillBeInstalledItems() -> [OptionalItem] {
let problem_item_names = getProblemItems().map(
{ return $0["name"] as? String ?? "" }
)
return getOptionalInstallItems().filter(
{
let status = $0["status"] as? String ?? ""
return ["install-requested", "will-be-installed",
"update-will-be-installed", "install-error"].contains(status)
let name = $0["name"] as? String ?? ""
return (["install-requested", "will-be-installed",
"update-will-be-installed", "install-error"].contains(status) &&
!problem_item_names.contains(name))
}
)
}
func getOptionalWillBeRemovedItems() -> [OptionalItem] {
let problem_item_names = getProblemItems().map(
{ return $0["name"] as? String ?? "" }
)
return getOptionalInstallItems().filter(
{
let status = $0["status"] as? String ?? ""
return ["removal-requested", "will-be-removed",
"removal-error"].contains(status)
let name = $0["name"] as? String ?? ""
return (["removal-requested", "will-be-removed",
"removal-error"].contains(status) &&
!problem_item_names.contains(name))
}
)
}