chore(db): set 30min before offline for battery endpoint
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
@@ -110,7 +110,7 @@ func (g *RestGateway) getBattery(c *gin.Context) {
|
|||||||
|
|
||||||
nodeFilter := buildNodeFilter(allNodes)
|
nodeFilter := buildNodeFilter(allNodes)
|
||||||
query := fmt.Sprintf(
|
query := fmt.Sprintf(
|
||||||
`SELECT "node", "battery" FROM "%s" WHERE %s AND time > now() - INTERVAL '3 hour' ORDER BY time DESC`,
|
`SELECT "node", "battery" FROM "%s" WHERE %s AND time > now() - INTERVAL '30 minutes' ORDER BY time DESC`,
|
||||||
g.measurementName, nodeFilter,
|
g.measurementName, nodeFilter,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ func (g *RestGateway) getBattery(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
battery, hasData := nodeBattery[nodeID]
|
battery, hasData := nodeBattery[nodeID]
|
||||||
if !hasData {
|
if !hasData {
|
||||||
battery = "offline (3h)"
|
battery = "offline (30 min)"
|
||||||
}
|
}
|
||||||
result[room][nodeID] = map[string]any{"battery": battery}
|
result[room][nodeID] = map[string]any{"battery": battery}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user