Skip to content

Commit 08ee674

Browse files
authored
[ᚬmaster] Rc/v0.9.2 (#558)
[ᚬmaster] Rc/v0.9.2
2 parents 04899fc + d8b182d commit 08ee674

File tree

59 files changed

+495
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+495
-177
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
.vscode
33
.idea/
4+
TAGS
45
ckb-explorer.iml
56
.generators
67
.rakeTasks

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# [0.9.2](https://github.com/shaojunda/ckb-explorer/compare/v0.9.1...v0.9.2) (2020-01-31)
2+
3+
4+
### Features
5+
6+
* add address average deposit time generator ([0618138](https://github.com/shaojunda/ckb-explorer/commit/0618138))
7+
* add average deposit time to address ([81469df](https://github.com/shaojunda/ckb-explorer/commit/81469df))
8+
* add claimed and unclaimed compensation ([268858d](https://github.com/shaojunda/ckb-explorer/commit/268858d))
9+
* add compensation and lock period ([e42b072](https://github.com/shaojunda/ckb-explorer/commit/e42b072))
10+
* add more elements to daily chart ([0e239b1](https://github.com/shaojunda/ckb-explorer/commit/0e239b1))
11+
* add new columns to daily statistic ([0a013c4](https://github.com/shaojunda/ckb-explorer/commit/0a013c4))
12+
* add unlaimed compenstaion generator worker ([ba0e105](https://github.com/shaojunda/ckb-explorer/commit/ba0e105))
13+
14+
15+
116
# [0.9.1](https://github.com/shaojunda/ckb-explorer/compare/v0.8.4...v0.9.0) (2020-01-13)
217

318

app/controllers/api/v1/dao_depositors_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Api
22
module V1
33
class DaoDepositorsController < ApplicationController
44
def index
5-
addresses = Address.where("dao_deposit > 0").order(dao_deposit: :desc).limit(100)
5+
addresses = Address.select(:id, :address_hash, :dao_deposit, :average_deposit_time).where("dao_deposit > 0").order(dao_deposit: :desc).limit(100)
66

77
render json: DaoDepositorSerializer.new(addresses)
88
end

app/controllers/api/v1/epoch_statistics_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class EpochStatisticsController < ApplicationController
44
before_action :validate_query_params
55

66
def show
7-
epoch_statistics = EpochStatistic.order(id: :desc).reverse
7+
epoch_statistics = EpochStatistic.order(epoch_number: :desc).limit(90).reverse
88
render json: EpochStatisticSerializer.new(epoch_statistics, { params: { indicator: params[:id] } })
99
end
1010

app/controllers/application_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def api_error(error)
2020
end
2121

2222
def check_header_info
23-
raise Api::V1::Exceptions::WrongContentTypeError if request.headers["Content-Type"] != "application/vnd.api+json"
24-
raise Api::V1::Exceptions::WrongAcceptError if request.headers["Accept"] != "application/vnd.api+json"
23+
raise Api::V1::Exceptions::InvalidContentTypeError if request.headers["Content-Type"] != "application/vnd.api+json"
24+
raise Api::V1::Exceptions::InvalidAcceptError if request.headers["Accept"] != "application/vnd.api+json"
2525
end
2626

2727
def validate_pagination_params

app/controllers/validations/daily_statistic.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def error_object
2525
attr_accessor :query_key
2626

2727
def query_key_format_must_be_correct
28-
if query_key.blank? || !query_key.in?(::DailyStatistic::VALID_INDICATORS)
28+
if query_key.blank? || !(query_key.split("-") - ::DailyStatistic::VALID_INDICATORS).empty?
2929
errors.add(:query_key, "indicator name is invalid")
3030
end
3131
end

app/lib/api/v1/exceptions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ def initialize(code:, status:, title:, detail:, href:)
1313
end
1414
end
1515

16-
class WrongContentTypeError < Error
16+
class InvalidContentTypeError < Error
1717
def initialize
1818
super code: 1001, status: 415, title: "Unsupported Media Type", detail: "Content Type must be application/vnd.api+json", href: "https://nervosnetwork.github.io/ckb-explorer/public/api_doc.html"
1919
end
2020
end
2121

22-
class WrongAcceptError < Error
22+
class InvalidAcceptError < Error
2323
def initialize
2424
super code: 1002, status: 406, title: "Not Acceptable", detail: "Accept must be application/vnd.api+json", href: "https://nervosnetwork.github.io/ckb-explorer/public/api_doc.html"
2525
end

app/models/address.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def special?
8080
# visible :boolean default(TRUE)
8181
# live_cells_count :decimal(30, ) default(0)
8282
# mined_blocks_count :integer default(0)
83+
# average_deposit_time :decimal(, )
8384
#
8485
# Indexes
8586
#

app/models/block.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def difficulty
5757
end
5858

5959
def block_index_in_epoch
60-
number - start_number
60+
number - start_number
6161
end
6262

6363
def fraction_epoch

app/models/cell_output.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class CellOutput < ApplicationRecord
1616

1717
attribute :tx_hash, :ckb_hash
1818

19+
scope :consumed_after, -> (block_timestamp) { where("consumed_block_timestamp >= ?", block_timestamp) }
1920
scope :consumed_before, -> (block_timestamp) { where("consumed_block_timestamp <= ?", block_timestamp) }
2021
scope :unconsumed_at, -> (block_timestamp) { where("consumed_block_timestamp > ? or consumed_block_timestamp is null", block_timestamp) }
2122
scope :generated_after, -> (block_timestamp) { where("block_timestamp >= ?", block_timestamp) }

0 commit comments

Comments
 (0)