diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index dfb67d12fb..01edc645a9 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -14,7 +14,7 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL', var countStacks = function(items) { return _.reduce(items,function(m,v){return m+v;},0);} $scope.$watch('user.items.pets', function(pets){ - window.habitrpgShared.helpers.countPets($rootScope.countExists(pets), User.user.items.pets); + $scope.petCount = window.habitrpgShared.helpers.countPets($rootScope.countExists(pets), User.user.items.pets); }, true); $scope.$watch('user.items.mounts', function(mounts){ $scope.mountCount = $rootScope.countExists(mounts); }, true); $scope.$watch('user.items.eggs', function(eggs){ $scope.eggCount = countStacks(eggs); }, true); diff --git a/src/models/user.js b/src/models/user.js index 402dddf34f..be5af289c7 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -267,7 +267,7 @@ UserSchema.pre('save', function(next) { 'Anonymous'; } - var petCount = _.reduce(this.items.pets,function(m,v){return m+(v ? 1 : 0);},0); + var petCount = helpers.countPets(_.reduce(this.items.pets,function(m,v){return m+(v?1:0)},0), this.items.pets); this.achievements.beastMaster = petCount >= 90; //our own version incrementer