Skip to content

Commit 9a49853

Browse files
authored
Merge pull request #2488 from nervosnetwork/develop
Deploy to testnet
2 parents 6f16131 + 89bf725 commit 9a49853

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/controllers/api/v2/udt_hourly_statistics_controller.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
module Api
22
module V2
33
class UdtHourlyStatisticsController < BaseController
4+
def index
5+
expires_in 15.minutes, public: true, stale_while_revalidate: 5.minutes, stale_if_error: 5.minutes
6+
7+
hourly_statistics = UdtHourlyStatistic.group(:created_at_unixtimestamp).
8+
select("created_at_unixtimestamp, SUM(ckb_transactions_count) AS ckb_transactions_count, SUM(holders_count) AS holders_count").
9+
order(created_at_unixtimestamp: :desc)
10+
11+
render json: {
12+
data: hourly_statistics.map do |statistic|
13+
{
14+
ckb_transactions_count: statistic.ckb_transactions_count.to_s,
15+
holders_count: statistic.holders_count.to_s,
16+
created_at_unixtimestamp: statistic.created_at_unixtimestamp.to_s,
17+
}
18+
end,
19+
}
20+
end
21+
422
def show
523
expires_in 15.minutes, public: true, stale_while_revalidate: 5.minutes, stale_if_error: 5.minutes
624

config/routes/v2.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
resources :graph_channels, only: :index
110110
resources :statistics, only: %i[index show]
111111
end
112-
resources :udt_hourly_statistics, only: :show
112+
resources :udt_hourly_statistics, only: %i[index show]
113113
resources :rgb_assets_statistics, only: :index
114114
resources :rgb_top_holders, only: :show
115115
end

0 commit comments

Comments
 (0)