mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix(analytics): problems
This commit is contained in:
@@ -205,7 +205,7 @@ api.createUserTasks = {
|
||||
|
||||
tasks.forEach(task => {
|
||||
// Track when new users (first 7 days) create tasks
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7) {
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7 && user.flags.welcomed) {
|
||||
res.analytics.track('task create', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
@@ -888,7 +888,7 @@ api.scoreTask = {
|
||||
}
|
||||
|
||||
// Track when new users (first 7 days) score tasks
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7 && user.flags.welcomed) {
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7) {
|
||||
res.analytics.track('task score', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
|
||||
@@ -790,7 +790,7 @@ api.hatch = {
|
||||
url: '/user/hatch/:egg/:hatchingPotion',
|
||||
async handler (req, res) {
|
||||
const { user } = res.locals;
|
||||
const hatchRes = common.ops.hatch(user, req);
|
||||
const hatchRes = common.ops.hatch(user, req, res.analytics);
|
||||
|
||||
await user.save();
|
||||
|
||||
@@ -881,7 +881,7 @@ api.feed = {
|
||||
url: '/user/feed/:pet/:food',
|
||||
async handler (req, res) {
|
||||
const { user } = res.locals;
|
||||
const feedRes = common.ops.feed(user, req);
|
||||
const feedRes = common.ops.feed(user, req, res.analytics);
|
||||
|
||||
await user.save();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user