mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Wrap task service in anon function
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
var TASK_KEYS_TO_REMOVE = ['_id', 'completed', 'date', 'dateCompleted', 'dateCreated', 'history', 'id', 'streak'];
|
||||||
|
|
||||||
angular
|
angular
|
||||||
.module('habitrpg')
|
.module('habitrpg')
|
||||||
.factory('Tasks', tasksFactory);
|
.factory('Tasks', tasksFactory);
|
||||||
@@ -27,8 +30,7 @@ function tasksFactory($rootScope, Shared, User) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _cleanUpTask(task) {
|
function _cleanUpTask(task) {
|
||||||
var keysToRemove = ['_id', 'completed', 'date', 'dateCompleted', 'dateCreated', 'history', 'id', 'streak'];
|
var cleansedTask = _.omit(task, TASK_KEYS_TO_REMOVE);
|
||||||
var cleansedTask = _.omit(task, keysToRemove);
|
|
||||||
|
|
||||||
// Copy checklists but reset to uncomplete and assign new id
|
// Copy checklists but reset to uncomplete and assign new id
|
||||||
_(cleansedTask.checklist).forEach(function(item) {
|
_(cleansedTask.checklist).forEach(function(item) {
|
||||||
@@ -48,3 +50,4 @@ function tasksFactory($rootScope, Shared, User) {
|
|||||||
cloneTask: cloneTask
|
cloneTask: cloneTask
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user