mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Adjust badges to match descriptions cc @coding-horror
This commit is contained in:
parent
1f2aa3aa8b
commit
717b54d64b
2 changed files with 9 additions and 12 deletions
|
@ -295,16 +295,13 @@ SQL
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.liked_back(min_posts, ratio)
|
def self.liked_back(likes_received, likes_given)
|
||||||
<<-SQL
|
<<-SQL
|
||||||
SELECT p.user_id, current_timestamp AS granted_at
|
SELECT us.user_id, current_timestamp AS granted_at
|
||||||
FROM posts AS p
|
FROM user_stats AS us
|
||||||
INNER JOIN user_stats AS us ON us.user_id = p.user_id
|
WHERE us.likes_received >= #{likes_received}
|
||||||
WHERE p.like_count > 0
|
AND us.likes_given >= #{likes_given}
|
||||||
AND (:backfill OR p.user_id IN (:user_ids))
|
AND (:backfill OR us.user_id IN (:user_ids))
|
||||||
GROUP BY p.user_id, us.likes_given
|
|
||||||
HAVING count(*) > #{min_posts}
|
|
||||||
AND (us.likes_given / count(*)::float) > #{ratio}
|
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -314,9 +314,9 @@ end
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
[Badge::ThankYou, "Thank You", BadgeType::Bronze, 20, 0.00],
|
[Badge::ThankYou, "Thank You", BadgeType::Bronze, 20, 10],
|
||||||
[Badge::GivesBack, "Gives Back", BadgeType::Silver, 100, 1.0],
|
[Badge::GivesBack, "Gives Back", BadgeType::Silver, 100, 100],
|
||||||
[Badge::Empathetic, "Empathetic", BadgeType::Gold, 500, 2.0],
|
[Badge::Empathetic, "Empathetic", BadgeType::Gold, 500, 1000]
|
||||||
].each do |spec|
|
].each do |spec|
|
||||||
id, name, level, count, ratio = spec
|
id, name, level, count, ratio = spec
|
||||||
Badge.seed do |b|
|
Badge.seed do |b|
|
||||||
|
|
Loading…
Reference in a new issue