mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 18:22:21 +00:00
WIP(teams): add some analytics, remove extraneous logic
This commit is contained in:
parent
221dd7a81e
commit
d53813adc7
4 changed files with 27 additions and 10 deletions
|
|
@ -1053,10 +1053,6 @@ export default {
|
|||
}
|
||||
if (this.isOpenTask) return false;
|
||||
if (this.task.group.assignedUsers.indexOf(this.user._id) !== -1) return false;
|
||||
if (
|
||||
this.task.group.assignedUsers.length > 0
|
||||
&& this.task.group.assignedUsers.indexOf(this.user._id) === -1
|
||||
) return true;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -710,6 +710,16 @@ api.updateTask = {
|
|||
task: savedTask,
|
||||
});
|
||||
}
|
||||
|
||||
if (group) {
|
||||
res.analytics.track('task edit', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
category: 'behavior',
|
||||
taskType: task.type,
|
||||
groupID: group._id,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -226,6 +226,14 @@ api.assignTask = {
|
|||
await Promise.all(promises);
|
||||
|
||||
res.respond(200, task);
|
||||
|
||||
res.analytics.track('task assign', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
category: 'behavior',
|
||||
taskType: task.type,
|
||||
groupID: group._id,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -338,19 +338,22 @@ async function scoreTask (user, task, direction, req, res) {
|
|||
|
||||
let localTask;
|
||||
let rollbackUser;
|
||||
let group;
|
||||
|
||||
if (task.group.id) {
|
||||
group = await Group.getGroup({
|
||||
user,
|
||||
groupId: task.group.id,
|
||||
fields: 'leader managers',
|
||||
});
|
||||
}
|
||||
if (
|
||||
task.group.id && !task.userId
|
||||
group && task.group.id && !task.userId
|
||||
&& direction === 'down'
|
||||
&& ['todo', 'daily'].includes(task.type)
|
||||
&& task.completed
|
||||
&& task.group.completedBy !== user._id
|
||||
) {
|
||||
const group = await Group.getGroup({
|
||||
user,
|
||||
groupId: task.group.id,
|
||||
fields: 'leader managers',
|
||||
});
|
||||
if (group.leader !== user._id && !group.managers[user._id]) {
|
||||
throw new BadRequest('Cannot uncheck task you did not complete if not a manager.');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue