Skip to content

Commit

Permalink
Merge pull request #2409 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid authored Jan 15, 2025
2 parents 8e2e9f1 + 2fbc9f6 commit 099e22e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions app/controllers/api/v1/blocks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ def index
order_by, asc_or_desc = params[:sort].split(".", 2)
order_by =
case order_by
when "height"
"number"
when "transactions"
"ckb_transactions_count"
else
order_by
when "height"
"number"

Check warning on line 24 in app/controllers/api/v1/blocks_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v1/blocks_controller.rb#L24

Added line #L24 was not covered by tests
when "transactions"
"ckb_transactions_count"

Check warning on line 26 in app/controllers/api/v1/blocks_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v1/blocks_controller.rb#L26

Added line #L26 was not covered by tests
else
order_by
end

head :not_found and return unless order_by.in? %w[number reward timestamp ckb_transactions_count]

blocks = blocks.order(order_by => asc_or_desc).page(@page).per(@page_size)
blocks = blocks.order(order_by => asc_or_desc).order("number DESC").page(@page).per(@page_size)

json =
Rails.cache.realize(blocks.cache_key, version: blocks.cache_version, race_condition_ttl: 3.seconds) do
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/omiga_inscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def sort_udts(records)
if sort == "mint_status"
records.joins(:omiga_inscription_info).order("omiga_inscription_infos.mint_status #{order}")
else
records.order("#{sort} #{order}")
records.order("#{sort} #{order}").order("full_name ASC, id ASC")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/udts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def sort_udts(records)
order = "asc"
end

records.order("#{sort} #{order}")
records.order("#{sort} #{order}").order("full_name ASC, id ASC")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/xudts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def sort_udts(records)
order = "asc"
end

records.order("#{sort} #{order}")
records.order("#{sort} #{order}").order("full_name ASC, id ASC")
end

def parse_tags
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/api/v2/pending_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def index
where.not(previous_cell_output_id: nil, from_cell_base: false).
pluck(:ckb_transaction_id).uniq
pending_transactions = CkbTransaction.where(id: unique_tx_ids).
order(transactions_ordering).page(@page).per(@page_size)
order(transactions_ordering).order("id DESC").page(@page).per(@page_size)

json = {
data: pending_transactions.map do |tx|
Expand All @@ -20,21 +20,21 @@ def index
capacity_involved: tx.capacity_involved,
transaction_fee: tx.transaction_fee,
created_at: tx.created_at,
create_timestamp: (tx.created_at.to_f * 1000).to_i
create_timestamp: (tx.created_at.to_f * 1000).to_i,
}
end,
meta: {
total: pending_transactions.total_count,
page_size: @page_size.to_i
}
page_size: @page_size.to_i,
},
}

render json: json
end

def count
render json: {
data: CkbTransaction.tx_pending.count
data: CkbTransaction.tx_pending.count,
}
end

Expand Down

0 comments on commit 099e22e

Please sign in to comment.