use countPets also for stats, fix #1898

This commit is contained in:
Matteo Pagliazzi
2013-11-23 17:42:47 +01:00
parent 6eed685004
commit df5a436338
2 changed files with 7 additions and 1 deletions

View File

@@ -24,6 +24,12 @@ 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 = window.habitrpgShared.helpers.countPets(null, User.user.items.pets);
$rootScope.$watch('user.items.pets', function(pets){
$rootScope.petCount = window.habitrpgShared.helpers.countPets($rootScope.countExists(pets), User.user.items.pets);
}, true);
$scope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {