mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
use countPets also for stats, fix #1898
This commit is contained in:
@@ -24,6 +24,12 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
// count pets, mounts collected totals, etc
|
// count pets, mounts collected totals, etc
|
||||||
$rootScope.countExists = function(items) {return _.reduce(items,function(m,v){return m+(v?1:0)},0)}
|
$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) {
|
$scope.safeApply = function(fn) {
|
||||||
var phase = this.$root.$$phase;
|
var phase = this.$root.$$phase;
|
||||||
if(phase == '$apply' || phase == '$digest') {
|
if(phase == '$apply' || phase == '$digest') {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ p
|
|||||||
span(popover-trigger='mouseenter', popover='(Level-1)/2') {{userDef(profile.stats.lvl)}}
|
span(popover-trigger='mouseenter', popover='(Level-1)/2') {{userDef(profile.stats.lvl)}}
|
||||||
p
|
p
|
||||||
strong Pets Found
|
strong Pets Found
|
||||||
| : {{countExists(profile.items.pets)}}
|
| : {{petCount}}
|
||||||
hr
|
hr
|
||||||
p
|
p
|
||||||
strong Total Experience Boost
|
strong Total Experience Boost
|
||||||
|
|||||||
Reference in New Issue
Block a user