Skip to content

Commit

Permalink
fix: filter committed address transactions (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitz authored Oct 8, 2023
1 parent 35e36c9 commit 755a05c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/api/v1/address_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class AddressTransactionsController < ApplicationController
before_action :set_address_transactions, only: [:show, :download_csv]

def show
@tx_ids = AccountBook.
joins(:ckb_transaction).
where(address_id: @address.id)
@tx_ids = AccountBook.joins(:ckb_transaction).
where(account_books: { address_id: @address.id },
ckb_transactions: { tx_status: "committed" })

params[:sort] ||= "ckb_transaction_id.desc"
order_by, asc_or_desc = params[:sort].split(".", 2)
Expand All @@ -29,7 +29,7 @@ def show
page(@page).per(@page_size).fast_page

order_by = "id" if order_by == "ckb_transaction_id"
@ckb_transactions = CkbTransaction.tx_committed.where(id: @tx_ids.map(&:ckb_transaction_id)).
@ckb_transactions = CkbTransaction.where(id: @tx_ids.map(&:ckb_transaction_id)).
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :capacity_involved).
order(order_by => asc_or_desc)

Expand Down

0 comments on commit 755a05c

Please sign in to comment.