Skip to content

Commit

Permalink
fix(api)!: if total value is queried for a period, replace the window…
Browse files Browse the repository at this point in the history
… start and end with the period for each row (#450)
  • Loading branch information
tothandras authored Nov 28, 2023
1 parent 850becc commit dbe4871
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/server/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ func (a *Router) QueryMeterWithMeter(w http.ResponseWriter, r *http.Request, log
Data: data,
}

// If total data is queried for a period, replace the window start and end with the period for each row
if params.WindowSize == nil {
for i := range resp.Data {
if params.From != nil {
resp.Data[i].WindowStart = *params.From
}
if params.To != nil {
resp.Data[i].WindowEnd = *params.To
}
}
}

// Parse media type
accept := r.Header.Get("Accept")
if accept == "" {
Expand Down

0 comments on commit dbe4871

Please sign in to comment.