Commit Graph

87 Commits

Author SHA1 Message Date
riking 6ce26ab4d8 FIX: Don't stop the badge grant after the first failure 2015-03-28 18:36:05 -07:00
Sam be48dfbb8c correct badge title revocation query 2014-10-09 22:01:08 +11:00
Sam 0e7be81e60 FIX: badge granted titles were not being revoked when badge was revoked 2014-10-08 10:26:18 +11:00
Sam 1792941098 Merge pull request #2740 from riking/badges_disabled
FIX: Do not perform grants if badges are disabled
2014-09-03 22:19:51 +10:00
riking 3cf493eb4f FIX: Apply contract checks when first creating a badge 2014-09-02 19:09:51 -07:00
riking ee812eb447 FIX: Do not perform grants if badges are disabled 2014-09-02 13:12:27 -07:00
riking 808460a28f Fix magic numbers, extra param references 2014-08-31 19:36:31 -07:00
riking 1833b43ae2 FEATURE: Badge query validation, preview results, and EXPLAIN
Upon saving a badge or requesting a badge result preview,
BadgeGranter.contract_checks! will examine the provided badge SQL for
some contractual obligations - namely, the returned columns and use of
trigger parameters.

Saving the badge is wrapped in a transaction to make this easier, by
raising ActiveRecord::Rollback on a detected violation.

On the client, a modal view is added for the badge query sample run
results, named admin-badge-preview.
The preview action is moved up to the route.
The save action, on failure, triggers a 'saveError' action (also in the
route).

The preview action gains a new parameter, 'explain', which will give the
output of an EXPLAIN query for the badge sql, which can be used by forum
admins to estimate the cost of their badge queries.
The preview link is replaced by two links, one which omits (false) and
includes (true) the EXPLAIN query.

The Badge.save() method is amended to propogate errors.

Badge::Trigger gets some utility methods for use in the
BadgeGranter.contract_checks! method.

Additionally, extra checks outside of BadgeGranter.contract_checks! are
added in the preview() method, to cover cases of null granted_at
columns.

An uninitialized variable path is removed in the backfill() method.

TODO - it would be nice to be able to get the actual names of all
columns the provided query returns, so we could give more errors
2014-08-31 11:25:44 -07:00
Sam 87d2be3ecf FIX: ensure triggered badges are never triggered if filter is missing 2014-08-27 18:02:13 +10:00
Sam 1baa55fe45 FIX: preview bust when no params 2014-08-13 12:25:56 +10:00
Sam 22cd259687 FIX: remove faulty "ensure consistency" badge job 2014-08-11 09:21:06 +10:00
Sam e6f0b94b3a FIX: bust preview
FIX: safeguard for huge delta backfill
2014-08-09 09:33:00 +10:00
Sam 953d3f2151 PERF: add optional delta badge filtering
This is tricky and optional, some badges are very expensive to calculate

pass in :backfill , :post_ids and :user_ids to all badge queries so they
can do pre-filtering, if you do it after the sub-query it is too late
2014-08-08 10:02:43 +10:00
Sam a34037b26c FIX: typo 2014-07-24 18:38:27 +10:00
Sam ec03d135fa FEATURE: allow advanced badge options in admin screen
clean up serializer, allow simplistic preview
2014-07-24 18:28:23 +10:00
Sam 0f9678fe49 FIX: faster update of all badges
Introduced badge triggers, introduced concept of badge that happens due to a post but has the post hidden

Delta badge grant happens once a minute, backed by redis
2014-07-23 11:46:07 +10:00
Sam 4c25fedf70 FEATURE: Reader badge
Read a every post in a topic that if 50 posts or longer
2014-07-15 15:16:41 +10:00
Sam 88469721b9 FEATURE: Allow admins to disable specific badges 2014-07-14 17:40:36 +10:00
Sam 0f25bbeaf7 FEATURE: Editor badge 2014-07-07 17:55:40 +10:00
Sam 4a25c86d61 FIX: correct duplicate granting 2014-07-05 18:32:06 +10:00
Sam 650e9348f3 FIX: multiple grant not working correctly 2014-07-04 17:41:03 +10:00
Sam 9a9ad9bda8 FEATURE: Badge progress
- Refactor model so it stores backfill query
- Implement autobiographer
- Remove sample badge
- Correct featured badges to only include a badge once
2014-07-03 17:29:44 +10:00
Sam bc44bfcdf2 Work in progress backfill for like badges 2014-07-01 22:01:15 +10:00
Vikhyat Korrapati 23983efeea Don't grant multiple_grant badges multiple times for the same post. 2014-06-28 00:32:09 +05:30
Vikhyat Korrapati 3ba65af19e Add like-based system badges. 2014-06-19 17:10:43 +05:30
Vikhyat Korrapati b5eea1d79f Grant system badges in a background job. 2014-06-19 17:10:37 +05:30
Vikhyat Korrapati b3f403952b Move badge grant_count updating to the UserBadge model callbacks. 2014-06-19 16:56:19 +05:30
Vikhyat Korrapati a68b47cb9f Add notification_id column to user_badges. 2014-06-19 16:56:19 +05:30
Vikhyat Korrapati 41ecba1b77 Mark badge notification as read when the notification is clicked. 2014-06-19 16:56:19 +05:30
Vikhyat Korrapati d208e4d517 Multiple grant badges. 2014-05-21 12:54:55 +05:30
Vikhyat Korrapati c07244a4e6 Refactor BadgeGranter.update_trust_level_badges! -> update_badges. 2014-05-14 21:01:41 +05:30
Vikhyat Korrapati b144b75565 Add automatically assigned trust level badges. 2014-05-14 20:47:21 +05:30
Vikhyat Korrapati 8113e8d897 Basic UI for selecting gold/silver badges as titles. 2014-04-18 09:20:51 +05:30
Vikhyat Korrapati 89f45901bc Create notification when badge is granted. 2014-04-17 01:58:01 +05:30
Sam 0d114d7b17 Tweak badge granter not to try to double grant 2014-04-14 15:58:52 +10:00
Vikhyat Korrapati dcaa069bb5 Log badge grant/revoke to the staff actions log. 2014-03-21 11:10:07 +05:30
Vikhyat Korrapati 9b26c8584e Initial badge system implementation. 2014-03-14 21:49:26 +05:30