Corrected how count is calculated

This commit is contained in:
Blade Barringer 2015-01-11 18:23:27 -06:00
parent f6885427a8
commit a72ae097d6

View file

@ -88,8 +88,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
// count pets, mounts collected totals, etc
$rootScope.countExists = function(items) {return _.reduce(items,function(m,v){return m+(v?1:0)},0)}
$rootScope.petCount = Shared.countPets(null, User.user.items.pets);
$rootScope.mountCount = Shared.countMounts(null, User.user.items.mounts);
$rootScope.petCount = Shared.countPets($rootScope.countExists(User.user.items.pets), User.user.items.pets);
$rootScope.mountCount = Shared.countMounts($rootScope.countExists(User.user.items.mounts), User.user.items.mounts);
$rootScope.$watch('user.items.pets', function(pets){
$rootScope.petCount = Shared.countPets($rootScope.countExists(pets), User.user.items.pets);