mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-22 03:34:14 +00:00
Fixed challenge member info. Fixed challenge winner selection
This commit is contained in:
parent
a7e71163c0
commit
21191fdc45
3 changed files with 16 additions and 9 deletions
|
|
@ -184,8 +184,8 @@ window.habitrpg = angular.module('habitrpg',
|
|||
url: '/:cid',
|
||||
templateUrl: 'partials/options.social.challenges.detail.html',
|
||||
title: env.t('titleChallenges'),
|
||||
controller: ['$scope', 'Challenges', '$stateParams', 'Tasks',
|
||||
function ($scope, Challenges, $stateParams, Tasks) {
|
||||
controller: ['$scope', 'Challenges', '$stateParams', 'Tasks', 'Members',
|
||||
function ($scope, Challenges, $stateParams, Tasks, Members) {
|
||||
Challenges.getChallenge($stateParams.cid)
|
||||
.then(function (response) {
|
||||
$scope.obj = $scope.challenge = response.data.data;
|
||||
|
|
@ -198,6 +198,11 @@ window.habitrpg = angular.module('habitrpg',
|
|||
if (!$scope.challenge[element.type + 's']) $scope.challenge[element.type + 's'] = [];
|
||||
$scope.challenge[element.type + 's'].push(element);
|
||||
})
|
||||
|
||||
return Members.getChallengeMembers($scope.challenge._id);
|
||||
})
|
||||
.then(function (response) {
|
||||
$scope.challenge.members = response.data.data;
|
||||
});
|
||||
}]
|
||||
})
|
||||
|
|
@ -226,11 +231,13 @@ window.habitrpg = angular.module('habitrpg',
|
|||
url: '/:uid',
|
||||
templateUrl: 'partials/options.social.challenges.detail.member.html',
|
||||
title: env.t('titleChallenges'),
|
||||
controller: ['$scope', 'Challenges', '$stateParams',
|
||||
function($scope, Challenges, $stateParams){
|
||||
$scope.obj = Challenges.Challenge.getMember({cid:$stateParams.cid, uid:$stateParams.uid}, function(){
|
||||
$scope.obj._locked = true;
|
||||
});
|
||||
controller: ['$scope', 'Members', '$stateParams',
|
||||
function($scope, Members, $stateParams){
|
||||
Members.getChallengeMemberProgress($stateParams.cid, $stateParams.uid)
|
||||
.then(function(response) {
|
||||
$scope.obj = response.data.data;
|
||||
$scope.obj._locked = true;
|
||||
});
|
||||
}]
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||
if (!challenge.winner) return;
|
||||
if (!confirm(window.env.t('youSure'))) return;
|
||||
|
||||
Challenges.selectWinner(challenge._id, challenge.winner)
|
||||
Challenges.selectChallengeWinner(challenge._id, challenge.winner)
|
||||
.then(function (response) {
|
||||
$scope.popoverEl.popover('destroy');
|
||||
_backToChallenges();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ angular.module('habitrpg')
|
|||
function selectChallengeWinner (challengeId, winnerId) {
|
||||
return $http({
|
||||
method: 'POST',
|
||||
url: apiV3Prefix + '/challenges/' + challengeId + 'selectWinner/' + winnerId,
|
||||
url: apiV3Prefix + '/challenges/' + challengeId + '/selectWinner/' + winnerId,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue