Skip to content

Commit

Permalink
api: reverse logic
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Sep 28, 2023
1 parent 31b767a commit 032c90d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ func (a *api) handleGetWeb3Index(c jape.Context) {
return
}

for _, day := range days {
for i := len(days) - 1; i > 0; i-- {
current, prev := days[i], days[i-1]
resp.Days = append(resp.Days, Web3IndexDay{
Date: day.Timestamp.Unix(),
Revenue: day.Revenue.USD,
Date: current.Timestamp.Unix(),
Revenue: current.Revenue.USD - prev.Revenue.USD,
})
}
c.Encode(resp)
Expand Down

0 comments on commit 032c90d

Please sign in to comment.