cleanup
All checks were successful
the build was successful

This commit is contained in:
konrad 2019-02-23 16:11:57 +01:00
parent dfde524f79
commit b7ead3e551
Signed by: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -313,7 +313,7 @@
editTaskSubmit() {
this.taskService.update(this.taskEditTask)
.then(r => {
this.list.updateTaskByID(r)
this.updateTaskInList(r)
this.$set(this, 'taskEditTask', r)
this.handleSuccess({message: 'The task was successfully updated.'})
})
@ -344,44 +344,6 @@
}
this.list.sortTasks()
},
fixStuffComingFromAPI(task) {
// Make date objects from timestamps
task.dueDate = this.parseDateIfNessecary(task.dueDate)
task.startDate = this.parseDateIfNessecary(task.startDate)
task.endDate = this.parseDateIfNessecary(task.endDate)
for (const rd in task.reminderDates) {
task.reminderDates[rd] = this.parseDateIfNessecary(task.reminderDates[rd])
}
// Make subtasks into empty array if null
if (task.subtasks === null) {
task.subtasks = []
}
return task
},
sortTasks(tasks) {
if (tasks === null) {
return tasks
}
return tasks.sort(function(a,b) {
if (a.done < b.done)
return -1
if (a.done > b.done)
return 1
return 0
})
},
parseDateIfNessecary(dateUnix) {
let dateobj = (+new Date(dateUnix * 1000))
if (dateobj === 0 || dateUnix === 0) {
dateUnix = null
} else {
dateUnix = dateobj
}
return dateUnix
},
updateLastReminderDate(selectedDates) {
this.lastReminder = +new Date(selectedDates[0])
},
@ -407,17 +369,6 @@
// Reset the last to 0 to have the "add reminder" button
this.taskEditTask.reminderDates[this.taskEditTask.reminderDates.length - 1] = null
},
removeNullsFromArray(array) {
for (const index in array) {
if (array[index] === null) {
array.splice(index, 1)
}
}
return array
},
formatUnixDate(dateUnix) {
return (new Date(dateUnix)).toLocaleString()
},
handleError(e) {
message.error(e, this)
},