I have the following use case: A user is able to "get" points for some reason and is able to spend them on different activities. Where the minimum amount should be 0 points.

Normal behavior (with one category of points):
1.- A user gets 100 points with an expiration date
2.- The user spend some points and now has 70 points
3.- On the expiration date the module will calculate the new amount as 70-100 = -30

Normal behavior (with two or more categories of points):
1.- A user get 100 points in category A (no expiration )and 300 points in category B (expiration). (A: is the default category)
2.- The user spend some points of category B and now has 170 points.
3.- On the expiration date the module will subtract 300 points of category B from 100 points of category A.
The final result will be: Category A -200 and category B 170 points.

The patch below will result in:
Modified behavior (with one category of points):
1.- ...
2.- ...
3.- On the expiration date the resulting amount will be 0 points.

Modified behavior (with two or more categories of points):
1.- ...
2.- ...
3.- The final result will be 100 points of category A and 0 points of category B.

The patch considers the problem described here #1477900: Expiration of categorized userpoints goes to Uncategorized, which is similar.
It adds a simple on/off switch to the modified behavior in admin/user/userpoints/expiration.

PD: please have in mind that this is my first patch

Comments

Status: Needs review » Needs work

The last submitted patch, userpoints-expiration-mode.patch, failed testing.

sapox’s picture

StatusFileSize
new2.89 KB

Update for re-testing

sapox’s picture

StatusFileSize
new2.89 KB

Now?

sapox’s picture

Status: Needs work » Needs review
StatusFileSize
new2.89 KB

...

Status: Needs review » Needs work

The last submitted patch, userpoints-expiration-mode_v3.patch, failed testing.

sapox’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB

Format is killing me.

sapox’s picture

Issue summary: View changes

Mistake in example

sapox’s picture

Issue summary: View changes

example fix

manuel.adan’s picture

Status: Needs review » Closed (outdated)

Closing this as outdated, 6.x version is no longer maintained.