Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
1.1k views
in Plugins by
As you aware admins can give bonus points directly from user-profile page in frontend. However, each given bonus points are not recorded, instead it is overriden. This should be improved. It is not the proper way.

Suppose that admin decides to give +50 points to a user via bonus points field. After a while admins again gives +75 points who a reason to the same user. In such a case admin should override previous given score and should consider it, so admins should give 75+50 points. After a time this working approach becomes very complicated. The admin cannot give when the first time bonus was given.

In this respect, I believe this should be improved by core hack or at least by plugin.
Q2A version: 1.8 customized

3 Answers

0 votes
by
selected by
 
Best answer
I have coded the plugin for customized bonus points. Please someone test this.

https://github.com/ihlassovbetov/q2a-bonusplus-gyzgyn
+2 votes
by

I fully get what you say. However, I think you're misusing bonus points. If an admin wants to give extra points to a user it is because of a "reason", as you said. The appropriate approach would be to model that reason itself rather than using a bag of points.

For example, you want to give points for answering more than 50 questions a month. Then, the best approach would model this so that each time a question is answered the questions in the month are checked and points are assigned automatically and categorized as "points earned for answering more than 50 questions" rather than just a generic "bonus". Otherwise, you won't be able to tell what category the points in the bag correspond to.

Sadly, the core won't allow plugins to change points without using that generic bonus field and support point recalculation at the same time.

In January 2017 I suggested a solution for this issue. I suggested creating a new plugin module called point. It allows plugins to inject code into the point calculation and point recalculation processes quite efficiently. As long as that, or any other solution, is not merged into the core, point recalculation in plugins (which I can't find the words to express how underrated it is) is a no-go.

by
Much needed :)
by
In my free time will start to develop such a plugin. I will inform you if I can.
by
1.5 years ago, when Q2A 1.7.x was the current version, I would have advised you to wait until that pull request is merged or added to the core somehow. As Q2A 1.8 has been released now and it has not been included I'd advice you to go ahead and try to do it. Note the complexity of doing so compared to my approach (implementing 2 methods) is approximately 500 to 1.
+1 vote
by

I agree with your opinion. My customers also want to add bonus freely. As you point out, the important thing is to keep bonus history (log).

Previously, I developed Point Trade plugin. This plugin supports SO bounty feature and point exchange feature between users. The most important feature of these functions is that the total point of all users does not change. In other words, points are only exchanged between users. This is also the limit of this feature. And one thing, user's points of Q2A must be able to recalculate according to certain rules. Therefore, what used the concern in development is the Q2A point re-calculation feature. If we record changes to the bonus in the history, we will be able to recalculate correctly.

I hope these things will be useful for developing New Bonus Feature.

by
I am still for a change of the point system in the core. We should do it like Stackoverflow (point recording instead of point recalculation): https://www.question2answer.org/qa/64803/building-a-better-trackable-point-system-for-q2a
...