# Gamification and invitations

**URL:** <https://meta.discourse.org/t/gamification-and-invitations/269544>\
**Category:** Bug\
**Tags:** gamification, invites\
**Created:** [June 25, 2023, 10:47am UTC](https://meta.discourse.org/t/gamification-and-invitations/269544 "2023-06-25T10:47:31Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [June 25, 2023, 10:47am UTC](https://meta.discourse.org/t/gamification-and-invitations/269544/1 "2023-06-25T10:47:31Z")

</div>

When using the Gamification plugin, points are rewarded for redeemed invitations.  
This is easily abused by sending out invites and redeeming them with a duplicate (fake) account.  
When such a fake account is removed by the admin, the behavior of the gamification plugin (and the invite system) depends on how the invite was sent.

- If the invite was **tied to a specific email address** and the user is removed, then both the `invite` record and `user_invite` records are hard(!) deleted. The next time the Sidekiq `UpdateScoresFor*` job runs, the gamification plugin will **deduct** the awarded points from the score again.

- If the invite was **not tied to a specific email address** and the user is removed, then the `invited_users` record will be removed, but the `invite` record will stay. The `redemption_count` value will not be decreased. This makes sense from one point of view because the invite redemption has taken place, even though the user has been removed afterwards. But the Gamification plugin uses the `redemption_count` to calculate the score so the points will **not be deducted**.

While debugging this, I also found that the score job will only consider invites that are less than 10 days old. So if an invite is redeemed after 11 days, no points will be awarded at all. I was going to say 'I guess it needs to look at `updated_at` instead of `created_at` but when the redemption count for the invite is increased, the `updated_at` timestamp is not being touched.

---

_[View the full topic](https://meta.discourse.org/t/gamification-and-invitations/269544)._
