diff --git a/db/src/rest/rest.go b/db/src/rest/rest.go index cabcc82..568ebfa 100644 --- a/db/src/rest/rest.go +++ b/db/src/rest/rest.go @@ -111,7 +111,7 @@ func (g *RestGateway) getRoomCurrent(c *gin.Context) { roomID := c.Param("room-id") // Get the last record for the specific room - query := fmt.Sprintf(`SELECT * FROM "%s" WHERE "room" = '%s' ORDER BY time DESC LIMIT 1`, g.measurementName, roomID) + query := fmt.Sprintf(`SELECT * FROM "%s" WHERE "room" = '%s' AND time > now() - INTERVAL '1 days' ORDER BY time DESC LIMIT 1`, g.measurementName, roomID) // Using context.Background() as seen in working snippet it, err := g.influxGateway.Query(context.Background(), query)