fix(analytics): Bad comparison

Corrects an error caught via test, where the check for intro tour completion would always fail. Also tweaks the updateUser behavior to save an explicit false if tour completion data is not found, including a test for that behavior.
This commit is contained in:
Sabe Jones
2015-07-27 15:13:59 -05:00
parent e9ed561907
commit f6bbae3beb
3 changed files with 5 additions and 2 deletions

View File

@@ -183,6 +183,7 @@ describe('Analytics Service', function () {
expectedProperties.Health = 48;
expectedProperties.Level = 24;
expectedProperties.Mana = 41;
expectedProperties.tutorialComplete = false;
beforeEach(function() {
user._id = 'unique-user-id';
@@ -192,6 +193,7 @@ describe('Analytics Service', function () {
user.stats.hp = 47.8;
user.stats.lvl = 24;
user.stats.mp = 41;
user.flags.tour.intro = 3;
analytics.updateUser(properties);
clock.tick();

View File

@@ -5,7 +5,7 @@ describe('groupServices', function() {
beforeEach(function() {
module(function($provide) {
$provide.value('User', {});
$provide.value('User', {user:user});
});
inject(function(_$httpBackend_, Groups, User) {

View File

@@ -107,7 +107,8 @@
properties.Level = user.stats.lvl;
properties.Mana = Math.floor(user.stats.mp);
}
if (user.flags.tour && user.flags.tour.intro === '-2') properties.tutorialComplete = true;
if (user.flags && user.flags.tour && user.flags.tour.intro === -2) {properties.tutorialComplete = true}
else {properties.tutorialComplete = false};
if (user.contributor && user.contributor.level) properties.contributorLevel = user.contributor.level;
if (user.purchased && user.purchased.plan.planId) properties.subscription = user.purchased.plan.planId;
}