mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
fix(analytics): Tweaks per code review
This commit is contained in:
parent
f6bbae3beb
commit
7c56f5e7f6
3 changed files with 7 additions and 4 deletions
|
|
@ -221,7 +221,8 @@ describe('analytics', function() {
|
|||
var user = {
|
||||
stats: stats,
|
||||
contributor: { level: 1 },
|
||||
purchased: { plan: { planId: 'foo-plan' } }
|
||||
purchased: { plan: { planId: 'foo-plan' } },
|
||||
flags: {tour: {intro: -2}}
|
||||
};
|
||||
|
||||
analyticsData.user = user;
|
||||
|
|
@ -246,7 +247,8 @@ describe('analytics', function() {
|
|||
Level: 4,
|
||||
Mana: 30,
|
||||
contributorLevel: 1,
|
||||
subscription: 'foo-plan'
|
||||
subscription: 'foo-plan',
|
||||
tutorialComplete: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@
|
|||
properties.Level = user.stats.lvl;
|
||||
properties.Mana = Math.floor(user.stats.mp);
|
||||
}
|
||||
if (user.flags && user.flags.tour && user.flags.tour.intro === -2) {properties.tutorialComplete = true}
|
||||
else {properties.tutorialComplete = false};
|
||||
properties.tutorialComplete = user.flags && user.flags.tour && user.flags.tour.intro === -2;
|
||||
if (user.contributor && user.contributor.level) properties.contributorLevel = user.contributor.level;
|
||||
if (user.purchased && user.purchased.plan.planId) properties.subscription = user.purchased.plan.planId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ function _formatUserData(user) {
|
|||
properties.Mana = Math.floor(user.stats.mp);
|
||||
}
|
||||
|
||||
properties.tutorialComplete = user.flags && user.flags.tour && user.flags.tour.intro === -2;
|
||||
|
||||
if (user.contributor && user.contributor.level) {
|
||||
properties.contributorLevel = user.contributor.level;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue