From 70049c37340ee839014a41b6e705594842eacf04 Mon Sep 17 00:00:00 2001 From: Rabbit Date: Mon, 3 Jun 2024 17:21:10 +0800 Subject: [PATCH 1/3] chore: parse capacity value (#1902) fix: export dao depositors query params --- app/jobs/csv_exportable/export_dao_depositors_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/csv_exportable/export_dao_depositors_job.rb b/app/jobs/csv_exportable/export_dao_depositors_job.rb index d0caebd8c..94d1ae77f 100644 --- a/app/jobs/csv_exportable/export_dao_depositors_job.rb +++ b/app/jobs/csv_exportable/export_dao_depositors_job.rb @@ -10,7 +10,7 @@ def perform(args) end if args[:end_date].present? - sql << " AND ckb_transactions.block_timestamp <= #{BigDecimal(args[:start_date])}" + sql << " AND ckb_transactions.block_timestamp <= #{BigDecimal(args[:end_date])}" end if args[:start_number].present? From 7954a26d970fc6631b278208d62ecb294c3a368d Mon Sep 17 00:00:00 2001 From: Rabbit Date: Mon, 3 Jun 2024 17:46:28 +0800 Subject: [PATCH 2/3] chore: filter out lock_types where type_script is empty (#1907) --- app/workers/bitcoin_transaction_detect_worker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/workers/bitcoin_transaction_detect_worker.rb b/app/workers/bitcoin_transaction_detect_worker.rb index 91917c9ed..768f7a952 100644 --- a/app/workers/bitcoin_transaction_detect_worker.rb +++ b/app/workers/bitcoin_transaction_detect_worker.rb @@ -113,10 +113,10 @@ def annotation_workflow_attributes(transaction) end } - input_lock_types = transaction.input_cells.map { _1.bitcoin_transfer&.lock_type }.uniq + input_lock_types = transaction.input_cells.where.not(type_script_id: nil).map { _1.bitcoin_transfer&.lock_type }.uniq sort_types.call(input_lock_types) - output_lock_types = transaction.cell_outputs.map { _1.bitcoin_transfer&.lock_type }.uniq + output_lock_types = transaction.cell_outputs.where.not(type_script_id: nil).map { _1.bitcoin_transfer&.lock_type }.uniq sort_types.call(output_lock_types) if input_lock_types == ["rgbpp"] From 4962060df5c2e9cf4262d92891a10f5a27490a85 Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Mon, 3 Jun 2024 20:01:34 +0800 Subject: [PATCH 3/3] feat: use database data as total_ live cells capacity (#1908) Signed-off-by: Miles Zhang --- app/models/daily_statistic.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/models/daily_statistic.rb b/app/models/daily_statistic.rb index 136485dbd..6c27c871f 100644 --- a/app/models/daily_statistic.rb +++ b/app/models/daily_statistic.rb @@ -383,17 +383,19 @@ def liquidity to_be_counted_date.days_ago(1).to_i * 1000, to_be_counted_date.to_i * 1000 - 1 ).consumed_after(to_be_counted_date.to_i * 1000).sum(:capacity) - { - over_three_years:, - one_year_to_three_years:, - six_months_to_one_year:, - three_months_to_six_months:, - one_month_to_three_months:, - one_week_to_one_month:, - day_to_one_week:, - latest_day:, - total_supply: total_supply + burnt, - }.transform_values { |value| (value.to_f / 10**8).truncate(8) } + base_attrs = + { + over_three_years:, + one_year_to_three_years:, + six_months_to_one_year:, + three_months_to_six_months:, + one_month_to_three_months:, + one_week_to_one_month:, + day_to_one_week:, + latest_day:, + } + total_live_capacities = base_attrs.values.sum + base_attrs.merge(total_supply: total_live_capacities).transform_values { |value| (value.to_f / 10**8).truncate(8) } end private