Skip to content

Commit

Permalink
feat: use task to reset ckb_hodl_wave (#1626)
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid authored Feb 7, 2024
1 parent 8bb8267 commit b076be9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def liquidity
day_to_one_week:,
latest_day:,
total_supply:,
}.transform_values { |value| (value / 10**8).truncate(8) }
}.transform_values { |value| (value.to_f / 10**8).truncate(8) }
end

private
Expand Down
11 changes: 11 additions & 0 deletions lib/tasks/migration/reset_daily_statistic_attribute.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace :migration do
desc "Usage: RAILS_ENV=production bundle exec rake 'migration:reset_daily_statistic_attribute[ckb_hodl_wave]'"
task :reset_daily_statistic_attribute, [:attribute] => :environment do |_, args|
attribute = args[:attribute]
DailyStatistic.where(attribute => nil).order("id asc").each do |ds|
puts ds.created_at_unixtimestamp
ds.reset_one!(attribute.to_sym)
end
puts "done"
end
end

0 comments on commit b076be9

Please sign in to comment.