mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
port allocateNow and autoAllocate
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import _ from 'lodash';
|
||||
import autoAllocate from '../fns/autoAllocate';
|
||||
|
||||
module.exports = function(user, req, cb) {
|
||||
_.times(user.stats.points, user.fns.autoAllocate);
|
||||
module.exports = function allocateNow (user) {
|
||||
_.times(user.stats.points, () => autoAllocate(user));
|
||||
user.stats.points = 0;
|
||||
if (typeof user.markModified === "function") {
|
||||
user.markModified('stats');
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, user.stats) : void 0;
|
||||
return {
|
||||
data: _.pick(user, 'stats'),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user