Skip to content

Commit

Permalink
fix: update task to refresh items_count value (#1667)
Browse files Browse the repository at this point in the history
* fix: update task to refresh items_count value

Signed-off-by: Miles Zhang <[email protected]>

* test: fix daily statistic generator test

Signed-off-by: Miles Zhang <[email protected]>

---------

Signed-off-by: Miles Zhang <[email protected]>
  • Loading branch information
zmcNotafraid authored Mar 5, 2024
1 parent 25cb885 commit cd72034
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ namespace :migration do

TokenCollection.find_each do |collection|
items_count = collection.items.normal.count
TokenCollection.update_counters(collection.id, items_count:)
holders_count = collection.items.normal.distinct.count(:owner_id)
collection.update_column(:holders_count, holders_count)
collection.update(holders_count:, items_count:)
progress_bar.increment
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/services/charts/daily_statistic_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class DailyStatisticGeneratorTest < ActiveSupport::TestCase
create(:cell_output, :with_full_transaction,
block_timestamp: @datetime.to_i * 1000, block: @block),
]
CellOutput.where(id: cells.map(&:id)).update_all(consumed_block_timestamp: (@datetime.to_i + 10) * 1000)
CellOutput.where(id: cells.map(&:id)).update_all(consumed_block_timestamp: (@datetime.to_i + 1) * 1000)
is_from_scratch = true
assert_equal "3",
Charts::DailyStatisticGenerator.new(@datetime,
Expand Down

0 comments on commit cd72034

Please sign in to comment.