hotfix for query chain-activity (#1543)
This commit is contained in:
parent
752f6117f5
commit
cdb56f0740
|
@ -383,6 +383,38 @@ func (r *Repository) buildChainActivityQuery(q *ChainActivityQuery) string {
|
|||
} else {
|
||||
field = "count"
|
||||
}
|
||||
|
||||
if q.TimeSpan == ChainActivityTs1Year || q.TimeSpan == ChainActivityTsAllTime {
|
||||
|
||||
if field == "notional" {
|
||||
field = "volume"
|
||||
}
|
||||
|
||||
var start string
|
||||
measurement := "chain_activity_1d"
|
||||
switch q.TimeSpan {
|
||||
case ChainActivityTs1Year:
|
||||
start = time.Now().AddDate(-1, 0, 0).Format(time.RFC3339)
|
||||
case ChainActivityTsAllTime:
|
||||
start = "1970-01-01T00:00:00Z"
|
||||
default:
|
||||
start = "1970-01-01T00:00:00Z"
|
||||
}
|
||||
|
||||
hotfixQuery := `
|
||||
import "date"
|
||||
|
||||
from(bucket: "%s")
|
||||
|> range(start: %s)
|
||||
|> filter(fn: (r) => r._measurement == "%s")
|
||||
|> filter(fn: (r) => r._field == "%s")
|
||||
|> drop(columns:["_time","to","_measurement"])
|
||||
|> sum()
|
||||
`
|
||||
return fmt.Sprintf(hotfixQuery, r.bucketInfiniteRetention, start, measurement, field)
|
||||
|
||||
}
|
||||
|
||||
var measurement string
|
||||
switch q.TimeSpan {
|
||||
case ChainActivityTs7Days:
|
||||
|
|
Loading…
Reference in New Issue