Skip to content

Commit

Permalink
fix(server): query param bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed May 28, 2019
1 parent 303bce9 commit 9ce6d5d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion server/app/models/ckb_sync/persist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ def update_ckb_transaction_display_outputs(ckb_transaction)

def update_transaction_fee(ckb_transaction)
transaction_fee = CkbUtils.ckb_transaction_fee(ckb_transaction)
assign_ckb_transaction_fee(ckb_transaction, transaction_fee)
return if transaction_fee.blank?

assign_ckb_transaction_fee(ckb_transaction, transaction_fee)
ApplicationRecord.transaction do
ckb_transaction.save!
block = ckb_transaction.block
Expand Down
2 changes: 1 addition & 1 deletion server/app/utils/ckb_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def self.ckb_transaction_fee(ckb_transaction)
previous_cell_output_capacities = 0
return if CellInput.where(ckb_transaction: ckb_transaction, from_cell_base: false, previous_cell_output_id: nil).exists?

previous_cell_output_ids = CellInput.where(ckb_transaction: ckb_transaction, from_cell_base: true).select("previous_cell_output_id")
previous_cell_output_ids = CellInput.where(ckb_transaction: ckb_transaction, from_cell_base: false).select("previous_cell_output_id")

if previous_cell_output_ids.exists?
previous_cell_output_capacities = CellOutput.where(id: previous_cell_output_ids).sum(:capacity)
Expand Down
2 changes: 1 addition & 1 deletion server/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_05_27_105726) do
ActiveRecord::Schema.define(version: 2019_05_28_014728) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down

0 comments on commit 9ce6d5d

Please sign in to comment.