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

Migrate unread_comments flag (fix inconsistencies) #587

Merged
merged 14 commits into from
Jan 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
# the unread_comments flag.
class FixUnreadCommentsInconsistencies < ActiveRecord::Migration[7.0]
def change
num_total_users = 0
users = User.all
num_fixed_users = 0

User.find_each do |user|
users.find_each do |user|
was_user_fixed = fix_unread_comments_flag(user)
Splines marked this conversation as resolved.
Show resolved Hide resolved
num_fixed_users += 1 if was_user_fixed
num_total_users += 1
end

Rails.logger.debug { "Ran through #{num_total_users} users (unread comments flag)" }
Rails.logger.debug { "Ran through #{users.length} users (unread comments flag)" }
Rails.logger.debug { "Fixed #{num_fixed_users} users (unread comments flag)" }
end

Expand Down