Problem/Motivation
A key problem with the API is that records in the userpoints table are not standalone records, they depend upon the previous revision record. This means that that individual userpoint records can't be removed or edited, instead a new revision has to be added that makes the change, but there's no connection on this new revision to the previous revision.
The expectation with a points system is that records would be created for each points addition, like a regular table:
| Entity type | Entity ID | Type | Created | Points |
|---|---|---|---|---|
| User | 5 | Account created | 2022-10-11 5:00am | 100 |
| User | 5 | Created comment #123 | 2022-10-11 5:01am | 5 |
| User | 5 | Created comment #124 | 2022-10-11 5:02am | 5 |
| User | 5 | Created comment #125 | 2022-10-11 5:03am | 5 |
| User | 5 | Created node #235 | 2022-10-11 5:10am | 10 |
| User | 5 | Liked node #222 | 2022-10-11 5:11am | 1 |
Totals could be either saved in a separate column, or through a separate API.
Proposed resolution
Change the API so that:
* Each userpoints record is a standalone thing, i.e. its own entity.
* The running total for a given type of point for a given entity would be generated using an API.
Remaining tasks
Change the API.
User interface changes
TBD
API changes
Lots :-)
Data model changes
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | userpoints-n3314902.zip | 39.29 KB | damienmckenna |
Comments
Comment #2
damienmckennaWIP alternative version of the module that stores uses separate userpoint records for each value instead of using revisions.
Comment #3
adriancid@DamienMcKenna I think you should ask to become a maintainer of this module and use your zip file as a starting point of the D10 version.
Comment #4
damienmckennaUnfortunately I don't use the module anymore.
Comment #5
pearls commentedI compared the zip folder(#2) and the current dev versions. There are significant differences. I hope a merge will be added soon.