Rename "Rookie of the Month" to "New User of the Month"

This commit is contained in:
Robin Ward 2017-03-31 16:30:30 -04:00
parent e6f6bd34d8
commit fc7fa4c0ad
5 changed files with 16 additions and 16 deletions

View File

@ -1,20 +1,20 @@
require 'badge_granter'
module Jobs
class GrantRookieBadges < Jobs::Scheduled
class GrantNewUserOfTheMonthBadges < Jobs::Scheduled
every 1.month
MAX_AWARDED = 2
def execute(args)
badge = Badge.find(Badge::RookieOfTheMonth)
badge = Badge.find(Badge::NewUserOfTheMonth)
scores.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)
if user.badges.where(id: Badge::RookieOfTheMonth).blank?
if user.badges.where(id: Badge::NewUserOfTheMonth).blank?
BadgeGranter.grant(badge, user)
SystemMessage.new(user).create('rookie_of_the_month', {
SystemMessage.new(user).create('new_user_of_the_month', {
month_year: Time.now.strftime("%B %Y")
})
end

View File

@ -56,7 +56,7 @@ class Badge < ActiveRecord::Base
GivesBack = 32
Empathetic = 39
RookieOfTheMonth = 44
NewUserOfTheMonth = 44
# other consts
AutobiographerMinBioLength = 10

View File

@ -2319,11 +2319,11 @@ en:
[Please review and fix them](%{base_url}/admin).
rookie_of_the_month:
title: "You're a Rookie of the Month!"
subject_template: "You're a Rookie of the Month!"
new_user_of_the_month:
title: "You're a New User of the Month!"
subject_template: "You're a New User of the Month!"
text_body_template: |
Congratulations, you've been awarded the **Rookie of the Month award for %{month_year}**.
Congratulations, you've been awarded the **New User of the Month award for %{month_year}**.
You received this because you've quickly become a valuable member of the community and other members are really enjoying your posts.
@ -3300,8 +3300,8 @@ en:
description: Replied to a Post via email
long_description: |
This badge is granted the first time you reply to a post via email :e-mail:.
rookie_of_the_month:
name: "Rookie of the Month"
new_user_of_the_month:
name: "New User of the Month"
description: Contributed a lot of value in their first month
long_description: |
This badge is granted to two high quality users who joined in the last month. The quality is determined by how many of their posts were liked and by whom.

View File

@ -402,8 +402,8 @@ Badge.seed do |b|
end
Badge.seed do |b|
b.id = Badge::RookieOfTheMonth
b.name = "Rookie of the Month"
b.id = Badge::NewUserOfTheMonth
b.name = "New User of the Month"
b.badge_type_id = BadgeType::Bronze
b.multiple_grant = false
b.target_posts = false

View File

@ -1,7 +1,7 @@
require 'rails_helper'
require_dependency 'jobs/scheduled/grant_rookie_badges'
require_dependency 'jobs/scheduled/grant_new_user_of_the_month_badges'
describe Jobs::GrantRookieBadges do
describe Jobs::GrantNewUserOfTheMonthBadges do
let(:granter) { described_class.new }
@ -14,7 +14,7 @@ describe Jobs::GrantRookieBadges do
granter.execute({})
badge = user.user_badges.where(badge_id: Badge::RookieOfTheMonth)
badge = user.user_badges.where(badge_id: Badge::NewUserOfTheMonth)
expect(badge).to be_present
end