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!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | userpoints_votingapi.install.patch | 693 bytes | fred0 |
| #4 | userpoints_votingapi.module.patch | 3.06 KB | fred0 |
| #3 | userpoints_votingapi.install.patch | 693 bytes | fred0 |
| #3 | userpoints_votingapi.module.patch | 3.06 KB | fred0 |
| #2 | userpoints_votingapi.install.patch | 693 bytes | fred0 |
Comments
Comment #1
fred0 commentedOops. 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
the <= actually allows 1 point above the threshold to be awarded.
It should just be
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.
Comment #2
fred0 commentedWould still love to see this change to the module. Here's patches against the latest (Sept 29, 2008) dev version.
Comment #3
fred0 commentedLet's try that again.
Comment #4
fred0 commentedRe-rolled to fix db_query to match change to the userpoints_txn schema.
Comment #5
kmillecam commentedCommitted to Dev.