Okay, so I’m trying to get our community to start using the like feature, and what better way than to gamify it?
So the idea is, every time they hand out 5 likes, they get a badge. Below is the query I believe does this, but I’d like to improve on it (and I need help).
SELECT pa.user_id, 0 post_id, current_timestamp granted_at FROM post_actions pa WHERE post_action_type_id = 2 AND (:backfill OR pa.post_id IN (:post_ids) ) GROUP BY pa.user_id HAVING COUNT(pa.post_id) % 5 = 0
As you can tell, it doesn’t associate to a post, so that’s problem number 1 (not sure if that can actually be resolved though).
Problem number 2 is I don’t know if I did this correctly. On my dev environment, I sort of have a mixed bag. I got the badge once, but when I liked 10 posts. I partially think that is because of how I initially setup the badge when I created like #5 and thus the first 5 were a “lesson learned”.
I originally had the badge setup to run daily, and then I switched it to when a user acts on a post (after I made my 5th like). Then I revoked a like and re-liked the same post to try and invoke the badge, and that didn’t work, so I liked 5 more posts and that gave me the badge immediately.
So now for the goodies: (here is how I have my badge setup in my dev environment)
Two additional questions (based on the UI):
What does “Run revocation query daily” mean? If I unlike a post and drop down to 9 likes, will it remove the 2 badge I received?
What does “Query target posts” mean? It seems if you can associate a post with the badge, it will go out and query that post? But what does it return?
Lastly, will the creation of this badge go out and grant people badges for the likes they’ve already given? As I don’t want that to happen. I simply want it based on likes given after the badge is created.