Closed (fixed)
Project:
User Points Contributed modules
Version:
6.x-1.x-dev
Component:
Code: userpoints_badges
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Aug 2010 at 14:53 UTC
Updated:
6 Sep 2010 at 02:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
mstef commentedThis was a pretty obvious fix..
In userpoints_badges_userpoints(), on $op = points after, you check badges already received and skip to the next one. Meaning that if the user's points dropped, you never check that again. What should be done, is all of the user's point badges should be removed, and re-added if the user is still above the point threshold.
Here's a patch
Comment #2
kbahey commentedThank you for contributing the patch.
It is now committed, and will be in the -dev release in about 9 hours from now.
Comment #3
mstef commentedAwesome - thanks
Comment #4
barrya commentedI've just been looking at this myself.
My understanding on how it currently works.
Badges are calculated on the users current points. if this increases above a badge threshold they are awarded that badge. If it decreases below a certain threshold then the badge is removed.
This works fine if a user is unable to spend their points, i.e. the points system is purely in place to track site activity etc. As soon as you bring points in as a reward system, i.e. do things on the site, earn points then exchange them for a reward then you are penalising your users for exchanging their points.
Both usages of badges are valid, and therefore rather than enforcing a one rule fits all situation, perhaps there should be a config option to set how point deductions are catered for? i.e. calculate badges on "lifetime points earned" or "current points balance".
Comment #5
barrya commentedYou know how an idea sticks in your head, and won't go away till you have done something about it? well here we go. Attached is a patch to do my idea above.
Comment #7
tbillion commentedbarrya I dont understand the format of this patch... the + and - are tooo crazy! think you could clear it up a bit?