Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: daily statistic dao_depositors_count #2399

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# TODO
# remove dao_depositors_count daily_dao_withdraw nodes_distribution nodes_count average_block_time columns
# remove daily_dao_withdraw nodes_distribution nodes_count average_block_time columns
class DailyStatistic < ApplicationRecord
include AttrLogics

Expand Down Expand Up @@ -216,6 +216,10 @@ def liquidity
select(:address_id)).distinct.count(:address_id)
end

define_logic :dao_depositors_count do
DaoEvent.depositor.created_before(ended_at).distinct.count(:address_id)
end

define_logic :circulation_ratio do
total_dao_deposit.to_i / circulating_supply
end
Expand Down Expand Up @@ -512,7 +516,7 @@ def yesterday_daily_statistic
if to_be_counted_date.beginning_of_day.to_i == Time.at(GENESIS_TIMESTAMP / 1000).in_time_zone.beginning_of_day.to_i \
|| aggron_first_day? \
|| yesterday_statistic.blank?
OpenStruct.new(addresses_count: 0, total_dao_deposit: 0,
OpenStruct.new(addresses_count: 0, total_dao_deposit: 0, dao_depositors_count: 0,
unclaimed_compensation: 0, claimed_compensation: 0,
average_deposit_time: 0, mining_reward: 0, deposit_compensation: 0,
treasury_amount: 0, total_depositors_count: 0,
Expand Down
2 changes: 1 addition & 1 deletion app/services/charts/daily_statistic_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def updated_attrs
daily_dao_depositors_count total_depositors_count unclaimed_compensation claimed_compensation deposit_compensation daily_dao_deposit total_dao_deposit circulating_supply circulation_ratio
}
others = %i{
block_timestamp transactions_count addresses_count
dao_depositors_count block_timestamp transactions_count addresses_count
average_deposit_time mining_reward knowledge_size
treasury_amount estimated_apc live_cells_count dead_cells_count avg_hash_rate
avg_difficulty uncle_rate address_balance_distribution
Expand Down
Loading