One of the things that has come up on my live site is that users are confused about the threshold for votes and points. The reason for this is that currently, the module looks at the votingapi_vote table and counts all votes for the past 24 hours in the threshold and awards points only if the that threshold isn't met. That means that if a user keeps voting on things after meeting the threshold, then those new votes that exceed the threshold can easily maintain the threshold and the user never (or rarely) gets new points after the period elapses for points awarded.

To fix that, I am suggesting we count points awarded in the time period instead of votes cast. That way, users can keep voting (should they choose to even thought they won't get points) and then they will start being awarded points again once previous vote points start to drop out of the threshold.

Also, it occurred to me that it might be nice to be able to define the time period in the interface to allow other options (hourly, daily, weekly, monthly annually).

I've attached patches that change the counting to use userpoints_txn to count the threshold and adds a custom time period setting. The userpoints_votingapi.install.patch file alters the variables table for the custom time period part.

I haven't fully tested these, but they seem to work. Can anyone else give it a whirl and confirm?

Thanks!

Comments

fred0’s picture

StatusFileSize
new3.13 KB

Oops. Already found bugs myself.
Here's a new patch for the module. The install file from the first post is fine.

This patch fixes a problem with the db_query statement. Also, it fixes a bug which exists in the current dev version of the module where on the last line is says

return ($number <= $threshold ? TRUE : FALSE);

the <= actually allows 1 point above the threshold to be awarded.
It should just be

return ($number < $threshold ? TRUE : FALSE);

Finally, it occurred to me that making the threshold a pre-defined array was restricting to the site admin and a freeform textfield made more sense so, that is changed as well.

fred0’s picture

Would still love to see this change to the module. Here's patches against the latest (Sept 29, 2008) dev version.

fred0’s picture

Let's try that again.

fred0’s picture

Re-rolled to fix db_query to match change to the userpoints_txn schema.

kmillecam’s picture

Status: Active » Fixed

Committed to Dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.