mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix(cron): remove now redundant logic
This commit is contained in:
@@ -126,19 +126,8 @@ async function cronAsync (req, res) {
|
|||||||
|
|
||||||
// Save user and tasks
|
// Save user and tasks
|
||||||
const toSave = [user.save()];
|
const toSave = [user.save()];
|
||||||
tasks.forEach(async task => {
|
tasks.forEach(task => {
|
||||||
if (task.isModified()) toSave.push(task.save());
|
if (task.isModified()) toSave.push(task.save());
|
||||||
if (task.isModified() && task.group && task.group.taskId) {
|
|
||||||
const groupTask = await Tasks.Task.findOne({
|
|
||||||
_id: task.group.taskId,
|
|
||||||
}).exec();
|
|
||||||
|
|
||||||
if (groupTask) {
|
|
||||||
let delta = (0.9747 ** task.value) * -1;
|
|
||||||
if (groupTask.group.assignedUsers) delta /= groupTask.group.assignedUsers.length;
|
|
||||||
await groupTask.scoreChallengeTask(delta, 'down');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
await Promise.all(toSave);
|
await Promise.all(toSave);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user