Skip to content

Commit

Permalink
Calculate balances count if count parameter specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaptoss committed Jul 5, 2024
1 parent 53d53f3 commit ba97db2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/service/handlers/leaderboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ func Leaderboard(w http.ResponseWriter, r *http.Request) {
return
}

leadersCount, err := BalancesQ(r).FilterDisabled().Count()
if err != nil {
Log(r).WithError(err).Error("Failed to count balances")
ape.RenderErr(w, problems.InternalError())
return
}

resp := newLeaderboardResponse(leaders)
resp.Links = req.GetLinks(r)
if req.Count {
leadersCount, err := BalancesQ(r).FilterDisabled().Count()
if err != nil {
Log(r).WithError(err).Error("Failed to count balances")
ape.RenderErr(w, problems.InternalError())
return
}

_ = resp.PutMeta(struct {
EventsCount int64 `json:"events_count"`
}{leadersCount})
Expand Down

0 comments on commit ba97db2

Please sign in to comment.