diff --git a/policy/executor/internal/nodes.go b/policy/executor/internal/nodes.go index c80d55b6..83680409 100644 --- a/policy/executor/internal/nodes.go +++ b/policy/executor/internal/nodes.go @@ -590,7 +590,8 @@ func (nodeData *ReportingJobNodeData) score() (*policy.Score, error) { if s == nil { return nil, nil } - policy.AddSpecdScore(calculator, s, rjRes.score != nil, rjRes.impact) + i := rjRes.impact + policy.AddSpecdScore(calculator, s, rjRes.score != nil, i) } policy.AddDataScore(calculator, len(nodeData.datapoints), finishedDatapoints) diff --git a/policy/score_calculator.go b/policy/score_calculator.go index 27f3eb03..7a908b8b 100644 --- a/policy/score_calculator.go +++ b/policy/score_calculator.go @@ -501,8 +501,13 @@ func (c *bandedScoreCalculator) Add(score *Score, impact *explorer.Impact) { if score.ScoreCompletion != 0 && score.Weight != 0 { category := uint32(0) - if impact != nil && impact.Value != nil { - category = 100 - uint32(impact.Value.Value) + if impact != nil { + // Store pointer to avoid panic + if impactV := impact.GetValue(); impactV != nil { + if value := impactV.GetValue(); value < 100 && value > 0 { + category = 100 - uint32(value) + } + } } if category <= 10 {