Skip to content
Snippets Groups Projects
Commit d8add2bd authored by tmn21's avatar tmn21 :rocket:
Browse files

ISSUE #46: CREATE task restart users' streak

parent abe507a3
No related branches found
No related tags found
1 merge request!44ISSUE #46: CREATE task restart users' streak
Pipeline #34334 failed
......@@ -17,7 +17,9 @@ namespace :user do
end
desc "Restart users' streak"
task :restart_streaks => :environment do
User.all.each do |user|
noStreakIds = User.where(streak: 0).pluck(:id)
users = User.where.not(id: noStreakIds)
users.each do |user|
days = (Date.today - user.last_action_at).to_i
if days >= 2
user.update_attribute(:streak, 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment