Metrics: tolerate NULL energy buckets in importProfile (#30169)
This commit is contained in:
parent
cf7a95b61a
commit
5857cde809
1 changed files with 2 additions and 1 deletions
|
|
@ -18,7 +18,8 @@ func importProfile(entity entity, from time.Time) (*[96]float64, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
rows, err := db.Query(`SELECT min(ts) AS ts, avg(energy) AS energy
|
||||
// COALESCE guards against legacy rows with NULL energy
|
||||
rows, err := db.Query(`SELECT min(ts) AS ts, COALESCE(avg(energy), 0) AS energy
|
||||
FROM meters
|
||||
WHERE meter = ? AND ts >= ?
|
||||
GROUP BY strftime("%H:%M", ts, 'unixepoch', 'localtime')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue