pull/15615/head
R.B. Boyer 2022-11-30 11:10:03 -06:00
parent 65c70e84ec
commit 4372a5221c
1 changed files with 6 additions and 5 deletions

View File

@ -672,8 +672,11 @@ var statusScores = map[string]int{
api.HealthPassing: 4, api.HealthPassing: 4,
} }
func isStatusBetter(curr, next string) bool { func getMostImportantStatus(a, b string) string {
return statusScores[next] < statusScores[curr] if statusScores[a] < statusScores[b] {
return a
}
return b
} }
func flattenChecks( func flattenChecks(
@ -696,9 +699,7 @@ func flattenChecks(
healthStatus = api.HealthMaint healthStatus = api.HealthMaint
break // always wins break // always wins
} }
if isStatusBetter(healthStatus, chk.Status) { healthStatus = getMostImportantStatus(healthStatus, chk.Status)
healthStatus = chk.Status
}
} }
} }