From de6104dda67a1c48405914993aca544f47193d33 Mon Sep 17 00:00:00 2001 From: konrad Date: Sat, 22 Dec 2018 20:50:32 +0000 Subject: [PATCH] Task duration (#13) --- src/components/lists/ShowList.vue | 58 +++++++++++++++++++++++++------ todo.md | 2 +- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/src/components/lists/ShowList.vue b/src/components/lists/ShowList.vue index a97ec08d6..89592f18c 100644 --- a/src/components/lists/ShowList.vue +++ b/src/components/lists/ShowList.vue @@ -107,6 +107,34 @@ +
+ +
+
+ + +
+
+ + +
+
+
+
@@ -339,8 +367,10 @@ const cancel = message.setLoading(this) // Convert the date in a unix timestamp - let duedate = (+ new Date(this.taskEditTask.dueDate)) / 1000 - this.taskEditTask.dueDate = duedate + this.taskEditTask.dueDate = (+ new Date(this.taskEditTask.dueDate)) / 1000 + this.taskEditTask.startDate = (+ new Date(this.taskEditTask.startDate)) / 1000 + this.taskEditTask.endDate = (+ new Date(this.taskEditTask.endDate)) / 1000 + // remove all nulls this.taskEditTask.reminderDates = this.removeNullsFromArray(this.taskEditTask.reminderDates) @@ -381,7 +411,7 @@ this.updateTaskByID(this.taskEditTask.id, response.data) // Also update the current taskedit object so the ui changes - this.$set(this, 'taskEditTask', response.data) + this.$set(this, 'taskEditTask', this.fixStuffComingFromAPI(response.data)) this.handleSuccess({message: 'The task was successfully updated.'}) cancel() // cancel the timers }) @@ -413,16 +443,13 @@ }, fixStuffComingFromAPI(task) { // Make date objects from timestamps - let dueDate = new Date(task.dueDate * 1000) - if (dueDate === 0) { - task.dueDate = null - } else { - task.dueDate = dueDate - } + 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] = new Date(task.reminderDates[rd] * 1000) - } + task.reminderDates[rd] = this.parseDateIfNessecary(task.reminderDates[rd]) + } // Make subtasks into empty array if null if (task.subtasks === null) { @@ -430,6 +457,15 @@ } return task }, + 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]) }, diff --git a/todo.md b/todo.md index 5fde113ad..7ba3e4a7d 100644 --- a/todo.md +++ b/todo.md @@ -85,6 +85,7 @@ * [ ] Teams with access to a list * [ ] Teams with access to a namespace * [x] Subtasks +* [x] Start/Enddatum für Tasks * [ ] Priorities * [ ] Sachen mit hoher Prio irgendwie hervorheben (rotes Dreieck zb) * [ ] Listen Kopieren @@ -95,7 +96,6 @@ * [ ] Assignees * [ ] Timeline/Calendar view * [ ] In und Out webhooks, mit Templates vom Payload -* [ ] Start/Enddatum für Tasks * [ ] Timeline/Calendar view -> Dazu tasks die in einem Bestimmten Bereich due sind, macht dann das Frontend * [ ] "Smart Lists", Listen nach bestimmten Kriterien gefiltert -> nur UI? * [ ] "Performance-Statistik" -> Wie viele Tasks man in bestimmten Zeiträumen so geschafft hat etc