Fix groupBy parameter parsing
parent
94977dc5ef
commit
20459a2f46
|
@ -1058,20 +1058,17 @@ func (s *PublicServer) apiBalanceHistory(r *http.Request, apiVersion int) (inter
|
||||||
// time.RFC3339
|
// time.RFC3339
|
||||||
toTime, _ = time.Parse("2006-01-02", t)
|
toTime, _ = time.Parse("2006-01-02", t)
|
||||||
}
|
}
|
||||||
var groupBy uint32
|
var groupBy uint64
|
||||||
i, err := strconv.ParseUint(r.URL.Query().Get("groupBy"), 10, 32)
|
groupBy, err = strconv.ParseUint(r.URL.Query().Get("groupBy"), 10, 32)
|
||||||
if err != nil || i <= 0 {
|
if err != nil || groupBy == 0 {
|
||||||
groupBy = 3600
|
groupBy = 3600
|
||||||
} else {
|
|
||||||
groupBy = uint32(i)
|
|
||||||
}
|
}
|
||||||
fiat := r.URL.Query().Get("fiatcurrency")
|
fiat := r.URL.Query().Get("fiatcurrency")
|
||||||
|
history, err = s.api.GetXpubBalanceHistory(r.URL.Path[i+1:], fromTime, toTime, fiat, gap, uint32(groupBy))
|
||||||
history, err = s.api.GetXpubBalanceHistory(r.URL.Path[i+1:], fromTime, toTime, fiat, gap, groupBy)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.metrics.ExplorerViews.With(common.Labels{"action": "api-xpub-balancehistory"}).Inc()
|
s.metrics.ExplorerViews.With(common.Labels{"action": "api-xpub-balancehistory"}).Inc()
|
||||||
} else {
|
} else {
|
||||||
history, err = s.api.GetBalanceHistory(r.URL.Path[i+1:], fromTime, toTime, fiat, groupBy)
|
history, err = s.api.GetBalanceHistory(r.URL.Path[i+1:], fromTime, toTime, fiat, uint32(groupBy))
|
||||||
s.metrics.ExplorerViews.With(common.Labels{"action": "api-address-balancehistory"}).Inc()
|
s.metrics.ExplorerViews.With(common.Labels{"action": "api-address-balancehistory"}).Inc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue