Updated add and remove tests for challenges (#7155)

This commit is contained in:
Keith Holliday
2016-05-08 11:35:38 -05:00
committed by Matteo Pagliazzi
parent 94220c5483
commit e747bba669
3 changed files with 38 additions and 20 deletions

View File

@@ -234,11 +234,11 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
var task = Shared.taskDefaults({text: listDef.newTask, type: listDef.type});
Tasks.createChallengeTasks(challenge._id, task);
if (!challenge[task.type + 's']) challenge[task.type + 's'] = [];
challenge[task.type + 's'].push(task);
challenge[task.type + 's'].unshift(task);
delete listDef.newTask;
};
$scope.removeTask = function(task, list) {
$scope.removeTask = function(task, challenge) {
if (!confirm(window.env.t('sureDelete', {taskType: window.env.t(task.type), taskText: task.text}))) return;
Tasks.deleteTask(task._id);
var index = challenge[task.type + 's'].indexOf(task);