challenges: include challenges that user created, or belongs to, even if

not in group anymore
This commit is contained in:
Tyler Renelle 2013-11-14 20:30:25 -08:00
parent 550ca394a9
commit 3461d67995

View file

@ -3,15 +3,14 @@
habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state',
function($scope, User, Challenges, Notification, $compile, Groups, $state) { function($scope, User, Challenges, Notification, $compile, Groups, $state) {
// FIXME get this from cache // FIXME $scope.challenges needs to be resolved first (see app.js)
Groups.Group.query({type:'party,guilds,tavern'}, function(groups){ Challenges.Challenge.query(function(challenges){
$scope.groups = groups; $scope.challenges = challenges;
$scope.groups = _.uniq(_.pluck(challenges, 'group'), function(g){return g._id});
$scope.search = { $scope.search = {
group: _.transform(groups, function(m,g){m[g._id]=true;}) group: _.transform($scope.groups, function(m,g){m[g._id]=true;})
}; };
}); });
// FIXME $scope.challenges needs to be resolved first (see app.js)
$scope.challenges = Challenges.Challenge.query();
// we should fix this, that's pretty brittle // we should fix this, that's pretty brittle
// override score() for tasks listed in challenges-editing pages, so that nothing happens // override score() for tasks listed in challenges-editing pages, so that nothing happens