feat(teams): quick add

Also fixes issue with lock icons
Also hides task copies from personal task board
This commit is contained in:
Sabe Jones
2021-05-05 16:55:07 -05:00
committed by SabreCat
parent a5680836bd
commit 072b09e030
5 changed files with 28 additions and 8 deletions

View File

@@ -303,6 +303,7 @@ export default function scoreTask (options = {}, req = {}, analytics) {
user.achievements.streak = user.achievements.streak ? user.achievements.streak + 1 : 1;
if (user.addNotification) user.addNotification('STREAK_ACHIEVEMENT');
}
if (task.group) task.group.completedBy = user._id;
task.completed = true;
// Save history entry for daily
@@ -320,6 +321,7 @@ export default function scoreTask (options = {}, req = {}, analytics) {
user.achievements.streak = user.achievements.streak ? user.achievements.streak - 1 : 0;
}
task.streak -= 1;
if (task.group && task.group.completedBy) task.group.completedBy = undefined;
task.completed = false;
// Delete history entry when daily unchecked
@@ -335,9 +337,11 @@ export default function scoreTask (options = {}, req = {}, analytics) {
if (direction === 'up') {
task.dateCompleted = new Date();
task.completed = true;
if (task.group) task.group.completedBy = user._id;
} else if (direction === 'down') {
task.completed = false;
task.dateCompleted = undefined;
if (task.group && task.group.completedBy) task.group.completedBy = undefined;
}
delta += _changeTaskValue(user, task, direction, times, cron);