I worked in a module time ago (since charts is available) to provide a graphical view for the user point 'history'.
In my setup (a gaming site) having such a view like this (the attached image) would provide more sense of "award" for each point a user gets as they all requested. Finally I did a quick integration with chart and userpoints to just provide the graphical evolution of the user's points.
Now, I would like to share the module, but before start creating new problematic issues I guess the best idea would be to test your own impressions about what to do with something like this. I'll tell you about the inners of the module and then you can consider some tweaking or features to be included for the first public version.
The module does not require any table, it just queries the transactions table using an interval value for the horizontal separator, it can be month/week/day/hour and adds points earned and removes points expired in the interval. The final array is used to build the chart for the user with the same settings. It's quite simple in concept and in code. The most difficult part is to make it themeable IMHO. An administration interface let's you define the kind of interval to be shown (last week, last month, last year, all user lifetime). The local task menu is created automatically (optional feature controlled by a checkbox in the admin interface), to create shortcuts for the view, but it's a menu handler as user/%user/history/%categories what handles the whole information (you may have a view for 2 or more categories using the , separator).
Default views are the same as defined in the filter for userpoints: "all points" (each one has it's own line in the chart), the special "uncategorized" case, and each category. All should obey the interval behaviour defined in the administration settings.
As in my site I'm not removing old points from DB, I can have the 'all user lifetime' view easily, but if the txn are to be removed from the database, a table should be create to keep the value of the total points up to the first entry remaining in the txn table, to start the total SUM with that value.
So, What do you think about it?
| Attachment | Size |
|---|---|
| history.PNG | 17.62 KB |
Comments
Great idea
Just what I was looking for. Planned on writing my own originally, but it seems you already did alot of work.
Do you generate the history as an image?
I was thinking about using Plotkit ( http://www.liquidx.net/plotkit/ ) or similar since it is more easily themeable.
Did you publish any code so far?
any comments?
I've published code 3 weeks ago, and I've found some people is using it, but don't know if they got referenced by this thread. Did you do any test afterall? can you suggest any more ideas about?
thanks in advance
Not yet published, but I could share for now
It was my idea to get enough intention about module usage so it could be included in userpoints contrib module. In the end I would create a new drupal module for this if doesn't fits any of the current modules for userpoints usage.
For image generation I'm using google chart api with http://drupal.org/project/chart, works really fine. I did develop the module using an old version of gchart and got a lot of warnings, I hope all these were cleared as for now.
So, proposal for include in other userpoints module or do I create a new module?
BTW, needs some tweakings to be nice, but the hard part is almost done, even discounting expired points on the graphs...
For now
I would create it as a new module. This way it can be tested by the maintainers of the userpoint-contrib module. Once they tested it and found it stable they can then include it in their collection.
This way it is also possible to get feedback on the module even if it would be decided not to include it.
mmm
http://drupal.org/project/userpoints_history
I'll be updating code today and do a commit for testing of current status.
storm the front..
I've uploaded a working version (not so clean as I would like) in the 6--1 CVS branch of the module. It includes a helper module to generate some dummy transactions. User cvs to grab it. Code is documented enough as well as the readme files, I hope!.
You will need the latest versions of userpoints and chart modules, as dependecies (obviously).
Just leave it in case someone wants to give a chance. I'll be on hollydays until August 10th, so.. don't expect more movement since then!