This commits avoid to call recompute when you write on the rank without
touch the karma_min value.
On write on karma_min, we have 2 cases:
- Rank order are the same, just need to recompute the rank for the user
that could be impacted. Eg. if karma_min changes from 45 to 50, we need
to recheck for all user between 45 and 50 their new rank.
- Rank order are not the same, we need to recompute for all users.
(could be still improved if needed)
When you recompute the rank on a list of users, depending of the number of
users (bulk if more than 3 * number of rank) we check for each user what is
the new rank, or for each rank whats is the new users.
task-internal
No way to edit a rank on the prod server. Lock sql -> crash server
closesodoo/odoo#34835
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Since 960360a, when computing badge stats, a datetime was compared to a
string leading to a traceback. e.g. when clicking in employess >
badges.
Also, due to a typo, the compute method was assigning the stats result
to the wrong attributes. e.g. 'stats_my_this_month' instead of
'stat_my_this_month'.
With this commit, the above mentioned issues are fixed and a test is
covering these issues to avoid regression.
- Preserved explicit 3rd-party copyright notices
- Explicit boilerplate should not be necessary - copyright law applies
automatically in all countries thanks to Berne Convention + WTO rules,
and a reference to the applicable license is clear enough.