- def execute(args)
- badge = Badge.find(Badge::NewUserOfTheMonth)
- return unless SiteSetting.enable_badges? && badge.enabled?
- previous_month_beginning = 1.month.ago.beginning_of_month
- previous_month_end = 1.month.ago.end_of_month
- if UserBadge.where(
- "badge_id = ? AND granted_at BETWEEN ? AND ?",
- badge.id,
- previous_month_beginning,
- Time.zone.now,
- ).exists?
- return
- end
- scores(previous_month_beginning, previous_month_end).each do |user_id, score|
- # Don't bother awarding to users who haven't received any likes
- if score > 0.0
- user = User.find(user_id)
This file has been truncated. show original