From 569480db1d55fb5b98658c4198219c13f77089e5 Mon Sep 17 00:00:00 2001 From: Rabbit Date: Mon, 23 Dec 2024 09:36:00 +0800 Subject: [PATCH] chore: update rgbpp assets statistic --- .../generate_rgbpp_assets_statistic_worker.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/workers/generate_rgbpp_assets_statistic_worker.rb b/app/workers/generate_rgbpp_assets_statistic_worker.rb index fb4798f2c..e1ae92a53 100644 --- a/app/workers/generate_rgbpp_assets_statistic_worker.rb +++ b/app/workers/generate_rgbpp_assets_statistic_worker.rb @@ -24,7 +24,8 @@ def perform(datetime = nil) def ft_count_attributes timestamp = CkbUtils.time_in_milliseconds(ended_at) - 1 - xudts_count = Udt.published_xudt.where(block_timestamp: ..timestamp).count + scope = Udt.where(udt_type: %i[xudt xudt_compatible], block_timestamp: ..timestamp) + xudts_count = scope.joins(:xudt_tag).where("xudt_tags.tags && ARRAY[?]::varchar[]", ["rgb++"]) { indicator: "ft_count", value: xudts_count, network: "global" } end @@ -36,15 +37,14 @@ def dob_count_attributes end def btc_transactions_count_attributes - transactions_count = BitcoinTransaction.where(time: started_at.to_i..ended_at.to_i).count + transactions_count = BitcoinTransaction.where(time: ..ended_at.to_i).count { indicator: "transactions_count", value: transactions_count, network: "btc" } end def ckb_transactions_count_attributes - started_timestamp = CkbUtils.time_in_milliseconds(started_at) ended_timestamp = CkbUtils.time_in_milliseconds(ended_at) - 1 transactions_count = BitcoinAnnotation.includes(:ckb_transaction). - where(ckb_transactions: { block_timestamp: started_timestamp..ended_timestamp }).count + where(ckb_transactions: { block_timestamp: ..ended_timestamp }).count { indicator: "transactions_count", value: transactions_count, network: "ckb" } end @@ -67,14 +67,14 @@ def ckb_holders_count_attributes def to_be_counted_date if @datetime.present? - return Time.zone.parse(@datetime) + return Time.parse(@datetime) end last_record = UdtHourlyStatistic.order(created_at_unixtimestamp: :desc).first if last_record - Time.zone.at(last_record.created_at_unixtimestamp) + 1.day + Time.at(last_record.created_at_unixtimestamp) + 1.day else - Time.current.yesterday + Time.now.yesterday end end