mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 11:36:45 +00:00
fix(cron): handle when leader not found
This commit is contained in:
parent
565d33f6a7
commit
86b0d6d86c
1 changed files with 7 additions and 1 deletions
|
|
@ -9,7 +9,13 @@ const MIN_TASK_VALUE = -47.27;
|
|||
|
||||
async function updateTeamTasks (team) {
|
||||
const toSave = [];
|
||||
const teamLeader = await User.findOne({ _id: team.leader }, 'preferences').exec();
|
||||
let teamLeader = await User.findOne({ _id: team.leader }, 'preferences').exec();
|
||||
|
||||
if (!teamLeader) { // why would this happen?
|
||||
teamLeader = {
|
||||
preferences: { }, // when options are sanitized this becomes CDS 0 at UTC
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
!team.cron || !team.cron.lastProcessed
|
||||
|
|
|
|||
Loading…
Reference in a new issue