Skip to content

Commit

Permalink
fix SummarizeValues to return last non-NaN value
Browse files Browse the repository at this point in the history
  • Loading branch information
spacefreak86 committed Nov 29, 2024
1 parent cdab347 commit 8a550a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion expr/consolidations/consolidations.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ func SummarizeValues(f string, values []float64, XFilesFactor float32) float64 {
}
}
case "last", "current":
rv = values[len(values)-1]
rv = math.NaN()
for i := len(values) - 1; i >= 0; i-- {
if !math.IsNaN(values[i]) {
rv = values[i]
break
}
}
total = notNans(values)
case "range", "rangeOf":
vMax := math.Inf(-1)
Expand Down

0 comments on commit 8a550a5

Please sign in to comment.