[deploy] Refactor: Move beloved comment Badge to Sidekiq Cron (#9861)
This commit is contained in:
parent
d0c64206a3
commit
960c51fbc0
3 changed files with 8 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ module BadgeRewarder
|
|||
|
||||
def self.award_beloved_comment_badges(comment_count = 24)
|
||||
badge_id = Badge.find_by!(slug: "beloved-comment").id
|
||||
Comment.where("public_reactions_count > ?", comment_count).find_each do |comment|
|
||||
Comment.includes(:user).where("public_reactions_count > ?", comment_count).find_each do |comment|
|
||||
message = "You're famous! [This is the comment](#{URL.comment(comment)}) for which you are being recognized. 😄"
|
||||
achievement = BadgeAchievement.create(
|
||||
user_id: comment.user_id,
|
||||
|
|
|
|||
|
|
@ -17,3 +17,10 @@ award_yearly_club_badges:
|
|||
- ""
|
||||
- award_yearly_club_badges
|
||||
- ""
|
||||
award_beloved_comment_badges:
|
||||
cron: "5 0 * * *" # daily at 12:05 am UTC
|
||||
class: "BadgeAchievements::BadgeAwardWorker"
|
||||
args:
|
||||
- ""
|
||||
- award_beloved_comment_badges
|
||||
- ""
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
task award_badges: :environment do
|
||||
BadgeRewarder.award_beloved_comment_badges
|
||||
BadgeRewarder.award_streak_badge(4)
|
||||
BadgeRewarder.award_streak_badge(8)
|
||||
BadgeRewarder.award_streak_badge(16)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue