mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
Members: user .lean() to improve performances (#10399)
* perf(members): use lean where possible * fix unit tests * fix unit tests and update calls to old function * simplify code and add tests
This commit is contained in:
@@ -8,6 +8,9 @@ import {
|
||||
basicFields as basicGroupFields,
|
||||
model as Group,
|
||||
} from '../../models/group';
|
||||
import {
|
||||
model as User,
|
||||
} from '../../models/user';
|
||||
import * as Tasks from '../../models/task';
|
||||
import _ from 'lodash';
|
||||
import * as passwordUtils from '../../libs/password';
|
||||
@@ -90,7 +93,7 @@ api.getUser = {
|
||||
let {daysMissed} = user.daysUserHasMissed(new Date(), req);
|
||||
userToJSON.needsCron = false;
|
||||
if (daysMissed > 0) userToJSON.needsCron = true;
|
||||
user.addComputedStatsToJSONObj(userToJSON.stats);
|
||||
User.addComputedStatsToJSONObj(userToJSON.stats, userToJSON);
|
||||
}
|
||||
|
||||
return res.respond(200, userToJSON);
|
||||
|
||||
Reference in New Issue
Block a user