Use _.find for clickStart Quest

This commit is contained in:
Blade Barringer
2015-08-18 08:02:23 -05:00
parent 2e289777d5
commit ee6fe4f756

View File

@@ -537,7 +537,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
}; };
$scope.clickStartQuest = function(){ $scope.clickStartQuest = function(){
if (_.reduce(User.user.items.quests, function(a,v){a += v; return a}) > 0){ var hasQuests = _.find(User.user.items.quests, function(quest) {
return quest > 0;
});
if (hasQuests){
$rootScope.openModal("ownedQuests", { controller:"InventoryCtrl" }); $rootScope.openModal("ownedQuests", { controller:"InventoryCtrl" });
} else { } else {
$rootScope.$state.go('options.inventory.quests'); $rootScope.$state.go('options.inventory.quests');