2016-04-05 15:12:02 -04:00
|
|
|
require 'badge_queries'
|
2014-07-17 02:10:44 -04:00
|
|
|
|
|
|
|
BadgeGrouping.seed do |g|
|
2014-07-18 01:46:36 -04:00
|
|
|
g.id = BadgeGrouping::GettingStarted
|
2014-07-17 02:10:44 -04:00
|
|
|
g.name = "Getting Started"
|
2014-07-26 21:33:33 -04:00
|
|
|
g.default_position = 10
|
2014-07-17 02:10:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
BadgeGrouping.seed do |g|
|
2014-07-18 01:46:36 -04:00
|
|
|
g.id = BadgeGrouping::Community
|
2014-07-17 02:10:44 -04:00
|
|
|
g.name = "Community"
|
2014-07-26 21:33:33 -04:00
|
|
|
g.default_position = 11
|
2014-07-17 02:10:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
BadgeGrouping.seed do |g|
|
2014-07-18 01:46:36 -04:00
|
|
|
g.id = BadgeGrouping::Posting
|
2014-07-17 02:10:44 -04:00
|
|
|
g.name = "Posting"
|
2014-07-26 21:33:33 -04:00
|
|
|
g.default_position = 12
|
2014-07-17 02:10:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
BadgeGrouping.seed do |g|
|
2014-07-18 01:46:36 -04:00
|
|
|
g.id = BadgeGrouping::TrustLevel
|
2014-07-17 02:10:44 -04:00
|
|
|
g.name = "Trust Level"
|
2014-07-26 21:33:33 -04:00
|
|
|
g.default_position = 13
|
2014-07-17 02:10:44 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
BadgeGrouping.seed do |g|
|
2014-07-18 01:46:36 -04:00
|
|
|
g.id = BadgeGrouping::Other
|
2014-07-17 02:10:44 -04:00
|
|
|
g.name = "Other"
|
2014-07-26 21:33:33 -04:00
|
|
|
g.default_position = 14
|
2014-07-17 02:10:44 -04:00
|
|
|
end
|
|
|
|
|
2014-07-18 01:46:36 -04:00
|
|
|
# BUGFIX
|
2017-02-20 08:35:05 -05:00
|
|
|
Badge.exec_sql <<-SQL.squish
|
|
|
|
UPDATE badges
|
|
|
|
SET badge_grouping_id = -1
|
|
|
|
WHERE NOT EXISTS (
|
|
|
|
SELECT 1
|
|
|
|
FROM badge_groupings g
|
|
|
|
WHERE g.id = badge_grouping_id
|
|
|
|
) OR (id < 100 AND badge_grouping_id = #{BadgeGrouping::Other})
|
|
|
|
SQL
|
2014-07-18 01:46:36 -04:00
|
|
|
|
2017-02-20 08:35:05 -05:00
|
|
|
[
|
|
|
|
[Badge::BasicUser, "Basic User", BadgeType::Bronze],
|
|
|
|
[Badge::Member, "Member", BadgeType::Bronze],
|
|
|
|
[Badge::Regular, "Regular", BadgeType::Silver],
|
|
|
|
[Badge::Leader, "Leader", BadgeType::Gold],
|
|
|
|
].each do |id, name, type|
|
2014-05-04 14:15:38 -04:00
|
|
|
Badge.seed do |b|
|
2017-02-20 08:35:05 -05:00
|
|
|
b.id = id
|
|
|
|
b.name = name
|
|
|
|
b.badge_type_id = type
|
|
|
|
b.query = BadgeQueries.trust_level(id)
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::TrustLevel
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::TrustLevelChange
|
2014-09-05 02:38:29 -04:00
|
|
|
# allow title for tl3 and above
|
2017-02-20 08:35:05 -05:00
|
|
|
b.default_allow_title = id > 2
|
2014-10-02 01:55:33 -04:00
|
|
|
b.default_icon = "fa-user"
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-05-04 14:15:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-15 01:16:41 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::Reader
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Reader"
|
2014-07-15 01:16:41 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = false
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::Reader
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-15 01:16:41 -04:00
|
|
|
b.auto_revoke = false
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-15 01:16:41 -04:00
|
|
|
end
|
|
|
|
|
2014-07-11 03:32:29 -04:00
|
|
|
Badge.seed do |b|
|
2014-07-16 02:26:22 -04:00
|
|
|
b.id = Badge::ReadGuidelines
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Read Guidelines"
|
2014-07-11 03:32:29 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = false
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::ReadGuidelines
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-22 21:42:24 -04:00
|
|
|
b.trigger = Badge::Trigger::UserChange
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-11 03:32:29 -04:00
|
|
|
end
|
|
|
|
|
2014-07-09 21:18:02 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstLink
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Link"
|
2014-07-09 21:18:02 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::FirstLink
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostRevision
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-09 21:18:02 -04:00
|
|
|
end
|
|
|
|
|
2014-07-11 00:17:01 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstQuote
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Quote"
|
2014-07-11 00:17:01 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::FirstQuote
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostRevision
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-11 00:17:01 -04:00
|
|
|
end
|
|
|
|
|
2014-07-08 00:26:53 -04:00
|
|
|
Badge.seed do |b|
|
2014-07-08 22:17:39 -04:00
|
|
|
b.id = Badge::FirstLike
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Like"
|
2014-07-08 22:17:39 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::FirstLike
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostAction
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-08 22:17:39 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstFlag
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Flag"
|
2014-07-08 22:17:39 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
2014-07-22 21:42:24 -04:00
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::FirstFlag
|
2016-03-25 12:19:12 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostAction
|
2014-08-09 18:40:25 -04:00
|
|
|
b.auto_revoke = false
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-08 22:17:39 -04:00
|
|
|
end
|
|
|
|
|
2015-05-14 22:04:41 -04:00
|
|
|
[
|
|
|
|
[Badge::Promoter,"Promoter",BadgeType::Bronze,1,0],
|
2015-06-15 00:30:42 -04:00
|
|
|
[Badge::Campaigner,"Campaigner",BadgeType::Silver,3,1],
|
|
|
|
[Badge::Champion,"Champion",BadgeType::Gold,5,2],
|
2015-05-14 22:04:41 -04:00
|
|
|
].each do |id, name, type, count, trust_level|
|
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = name
|
2015-05-14 22:04:41 -04:00
|
|
|
b.default_icon = "fa-user-plus"
|
|
|
|
b.badge_type_id = type
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = false
|
|
|
|
b.show_posts = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.invite_badge(count,trust_level)
|
2015-05-14 22:04:41 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
# daily is good enough
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.auto_revoke = true
|
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-08 22:17:39 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstShare
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Share"
|
2014-07-08 00:26:53 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::FirstShare
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-31 22:48:11 -04:00
|
|
|
# don't trigger for now, its too expensive
|
|
|
|
b.trigger = Badge::Trigger::None
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-08 00:26:53 -04:00
|
|
|
end
|
|
|
|
|
2014-09-10 23:10:37 -04:00
|
|
|
[
|
|
|
|
[Badge::NiceShare, "Nice Share", BadgeType::Bronze, 25],
|
|
|
|
[Badge::GoodShare, "Good Share", BadgeType::Silver, 300],
|
|
|
|
[Badge::GreatShare, "Great Share", BadgeType::Gold, 1000],
|
2017-02-20 08:35:05 -05:00
|
|
|
].each do |id, name, level, count|
|
2014-09-10 23:10:37 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = name
|
2014-09-10 23:10:37 -04:00
|
|
|
b.badge_type_id = level
|
|
|
|
b.multiple_grant = true
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.sharing_badge(count)
|
2014-09-10 23:10:37 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
# don't trigger for now, its too expensive
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-03 03:29:44 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::Welcome
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Welcome"
|
2014-07-07 03:55:25 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
2014-07-03 03:29:44 -04:00
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::Welcome
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostAction
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-03 03:29:44 -04:00
|
|
|
end
|
2014-05-15 20:34:06 -04:00
|
|
|
|
2014-07-03 03:29:44 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::Autobiographer
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Autobiographer"
|
2014-07-07 03:55:25 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
2014-07-03 03:29:44 -04:00
|
|
|
b.multiple_grant = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::Autobiographer
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::UserChange
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-05-04 14:15:38 -04:00
|
|
|
end
|
2014-07-03 03:29:44 -04:00
|
|
|
|
2014-07-07 03:55:25 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::Editor
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Editor"
|
2014-07-07 03:55:25 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::Editor
|
2016-03-25 12:19:12 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostRevision
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-07-07 03:55:25 -04:00
|
|
|
end
|
|
|
|
|
2017-02-20 08:35:05 -05:00
|
|
|
[
|
|
|
|
[Badge::NicePost, "Nice Post", BadgeType::Bronze, false],
|
|
|
|
[Badge::GoodPost, "Good Post", BadgeType::Silver, false],
|
|
|
|
[Badge::GreatPost, "Great Post", BadgeType::Gold, false],
|
|
|
|
[Badge::NiceTopic, "Nice Topic", BadgeType::Bronze, true],
|
|
|
|
[Badge::GoodTopic, "Good Topic", BadgeType::Silver, true],
|
|
|
|
[Badge::GreatTopic, "Great Topic", BadgeType::Gold, true],
|
|
|
|
].each do |id, name, type, topic|
|
2014-06-17 02:29:49 -04:00
|
|
|
Badge.seed do |b|
|
2017-02-20 08:35:05 -05:00
|
|
|
b.id = id
|
|
|
|
b.name = name
|
|
|
|
b.badge_type_id = type
|
2014-09-10 22:36:37 -04:00
|
|
|
b.multiple_grant = true
|
2014-07-03 03:29:44 -04:00
|
|
|
b.target_posts = true
|
2014-07-22 21:42:24 -04:00
|
|
|
b.show_posts = true
|
2017-02-20 08:35:05 -05:00
|
|
|
b.query = BadgeQueries.like_badge(Badge.like_badge_counts[id], topic)
|
2014-07-18 01:46:36 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Posting
|
2014-07-21 22:46:31 -04:00
|
|
|
b.trigger = Badge::Trigger::PostAction
|
2014-08-05 20:51:39 -04:00
|
|
|
b.system = true
|
2014-06-17 02:29:49 -04:00
|
|
|
end
|
|
|
|
end
|
2014-08-05 20:51:39 -04:00
|
|
|
|
2015-02-18 13:30:07 -05:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::OneYearAnniversary
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "Anniversary"
|
2015-02-18 19:17:30 -05:00
|
|
|
b.default_icon = "fa-clock-o"
|
2015-02-19 15:39:49 -05:00
|
|
|
b.badge_type_id = BadgeType::Silver
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries::OneYearAnniversary
|
2015-02-18 13:30:07 -05:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.auto_revoke = false
|
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
|
2015-08-27 12:52:31 -04:00
|
|
|
[
|
|
|
|
[Badge::PopularLink, "Popular Link", BadgeType::Bronze, 50],
|
|
|
|
[Badge::HotLink, "Hot Link", BadgeType::Silver, 300],
|
|
|
|
[Badge::FamousLink, "Famous Link", BadgeType::Gold, 1000],
|
2017-02-20 08:35:05 -05:00
|
|
|
].each do |id, name, level, count|
|
2015-08-27 12:52:31 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = name
|
2015-08-27 12:52:31 -04:00
|
|
|
b.badge_type_id = level
|
|
|
|
b.multiple_grant = true
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.linking_badge(count)
|
2016-03-25 12:21:24 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::Posting
|
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Posting
|
2015-08-27 12:52:31 -04:00
|
|
|
# don't trigger for now, its too expensive
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-03-16 13:03:17 -04:00
|
|
|
[
|
|
|
|
[Badge::Appreciated, "Appreciated", BadgeType::Bronze, 1, 20],
|
|
|
|
[Badge::Respected, "Respected", BadgeType::Silver, 2, 100],
|
|
|
|
[Badge::Admired, "Admired", BadgeType::Gold, 5, 300],
|
2017-02-20 08:35:05 -05:00
|
|
|
].each do |id, name, level, like_count, post_count|
|
2016-03-16 13:03:17 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
|
|
|
b.name = name
|
|
|
|
b.default_icon = "fa-heart"
|
|
|
|
b.badge_type_id = level
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.liked_posts(post_count, like_count)
|
2016-03-16 13:03:17 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.auto_revoke = false
|
|
|
|
b.system = true
|
|
|
|
end
|
2016-03-15 14:46:21 -04:00
|
|
|
end
|
|
|
|
|
2016-03-16 13:48:14 -04:00
|
|
|
|
|
|
|
[
|
2016-03-22 10:51:42 -04:00
|
|
|
[Badge::ThankYou, "Thank You", BadgeType::Bronze, 20, 10],
|
|
|
|
[Badge::GivesBack, "Gives Back", BadgeType::Silver, 100, 100],
|
|
|
|
[Badge::Empathetic, "Empathetic", BadgeType::Gold, 500, 1000]
|
2017-02-20 08:35:05 -05:00
|
|
|
].each do |id, name, level, count, ratio|
|
2016-03-16 13:48:14 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = name
|
2016-03-16 13:48:14 -04:00
|
|
|
b.default_icon = "fa-heart"
|
|
|
|
b.badge_type_id = level
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.liked_back(count, ratio)
|
2016-03-16 14:44:42 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::Community
|
2016-03-16 13:48:14 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.auto_revoke = false
|
|
|
|
b.system = true
|
|
|
|
end
|
2016-03-15 14:14:10 -04:00
|
|
|
end
|
|
|
|
|
2016-03-16 12:31:26 -04:00
|
|
|
[
|
2016-03-17 11:42:22 -04:00
|
|
|
[Badge::OutOfLove, "Out of Love", BadgeType::Bronze, 1],
|
|
|
|
[Badge::HigherLove, "Higher Love", BadgeType::Silver, 5],
|
|
|
|
[Badge::CrazyInLove, "Crazy in Love", BadgeType::Gold, 20],
|
2017-02-20 08:35:05 -05:00
|
|
|
].each do |id, name, level, count|
|
2016-03-16 12:31:26 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = id
|
|
|
|
b.name = name
|
|
|
|
b.default_icon = "fa-heart"
|
|
|
|
b.badge_type_id = level
|
2016-04-05 15:12:02 -04:00
|
|
|
b.query = BadgeQueries.like_rate_limit(count)
|
2016-03-16 14:44:42 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::Community
|
2016-03-16 12:31:26 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::Community
|
|
|
|
b.trigger = Badge::Trigger::None
|
|
|
|
b.auto_revoke = false
|
|
|
|
b.system = true
|
|
|
|
end
|
2016-03-15 16:06:50 -04:00
|
|
|
end
|
|
|
|
|
2016-04-05 15:12:02 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstMention
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Mention"
|
2016-04-05 15:12:02 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
2016-04-06 14:01:11 -04:00
|
|
|
b.query = BadgeQueries::FirstMention
|
2016-04-05 15:37:41 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-04-05 15:12:02 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-04-06 14:01:11 -04:00
|
|
|
b.trigger = Badge::Trigger::PostRevision
|
2016-04-05 15:12:02 -04:00
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
|
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstEmoji
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Emoji"
|
2016-04-05 15:12:02 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
2016-04-07 12:27:26 -04:00
|
|
|
b.query = nil
|
2016-04-05 15:37:41 -04:00
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-04-05 15:12:02 -04:00
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-08-10 13:24:01 -04:00
|
|
|
b.trigger = Badge::Trigger::None
|
2016-04-05 15:12:02 -04:00
|
|
|
b.system = true
|
|
|
|
end
|
2016-03-16 12:31:26 -04:00
|
|
|
|
2016-04-12 14:09:59 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstOnebox
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Onebox"
|
2016-04-12 14:09:59 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
|
|
|
b.query = nil
|
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-08-10 13:24:01 -04:00
|
|
|
b.trigger = Badge::Trigger::None
|
2016-04-12 14:09:59 -04:00
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
|
2016-06-13 09:37:14 -04:00
|
|
|
Badge.seed do |b|
|
|
|
|
b.id = Badge::FirstReplyByEmail
|
2017-02-20 08:35:05 -05:00
|
|
|
b.name = "First Reply By Email"
|
2016-06-13 09:37:14 -04:00
|
|
|
b.badge_type_id = BadgeType::Bronze
|
|
|
|
b.multiple_grant = false
|
|
|
|
b.target_posts = true
|
|
|
|
b.show_posts = true
|
|
|
|
b.query = nil
|
|
|
|
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
|
|
|
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
2016-08-10 13:24:01 -04:00
|
|
|
b.trigger = Badge::Trigger::None
|
2016-06-13 09:37:14 -04:00
|
|
|
b.system = true
|
|
|
|
end
|
|
|
|
|
2014-08-05 20:51:39 -04:00
|
|
|
Badge.where("NOT system AND id < 100").each do |badge|
|
|
|
|
new_id = [Badge.maximum(:id) + 1, 100].max
|
|
|
|
old_id = badge.id
|
|
|
|
badge.update_columns(id: new_id)
|
|
|
|
UserBadge.where(badge_id: old_id).update_all(badge_id: new_id)
|
|
|
|
end
|