Change New User of the Month Badge to use trust level rather than age
This commit is contained in:
parent
a8d3779f0b
commit
e4b1376146
|
@ -33,8 +33,11 @@ module Jobs
|
|||
SUM(CASE
|
||||
WHEN pa.id IS NOT NULL THEN
|
||||
CASE
|
||||
WHEN liked_by.created_at > (CURRENT_TIMESTAMP - '1 week'::INTERVAL) THEN 0.1
|
||||
WHEN liked_by.created_at > (CURRENT_TIMESTAMP - '1 month'::INTERVAL) THEN 0.5
|
||||
WHEN liked_by.trust_level = 0 THEN 0.1
|
||||
WHEN liked_by.trust_level = 1 THEN 0.25
|
||||
WHEN liked_by.trust_level = 2 THEN 1.0
|
||||
WHEN liked_by.trust_level = 3 THEN 1.5
|
||||
WHEN liked_by.trust_level = 4 THEN 2.0
|
||||
ELSE 1.0
|
||||
END
|
||||
ELSE 0
|
||||
|
|
|
@ -64,11 +64,11 @@ describe Jobs::GrantNewUserOfTheMonthBadges do
|
|||
PostAction.act(new_user, p, PostActionType.types[:like])
|
||||
PostAction.act(med_user, p, PostActionType.types[:like])
|
||||
PostAction.act(old_user, p, PostActionType.types[:like])
|
||||
expect(granter.scores[user.id]).to eq(0.4)
|
||||
expect(granter.scores[user.id]).to eq(0.1875)
|
||||
|
||||
# It goes down the more they post
|
||||
Fabricate(:post, user: user)
|
||||
expect(granter.scores[user.id]).to eq(0.32)
|
||||
expect(granter.scores[user.id]).to eq(0.15)
|
||||
end
|
||||
|
||||
it "is limited to two accounts" do
|
||||
|
|
Loading…
Reference in New Issue