Fixed dragging tasks which didn't had dates set before
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9db8cf31dc
commit
f35df71591
|
@ -151,11 +151,10 @@
|
|||
parseTasks() {
|
||||
this.setDates()
|
||||
// The following three are split up in different functions to be able to call them independently
|
||||
this.filterTask()
|
||||
this.prepareTasks()
|
||||
this.sortTasks()
|
||||
this.addTaskGanttAttributes()
|
||||
},
|
||||
filterTask() {
|
||||
prepareTasks() {
|
||||
this.theTasks = this.tasks
|
||||
.filter(t => {
|
||||
if(t.startDate === null && !t.done) {
|
||||
|
@ -163,18 +162,18 @@
|
|||
}
|
||||
return t.startDate >= this.startDate
|
||||
})
|
||||
.map(t => {
|
||||
return this.addGantAttributes(t)
|
||||
})
|
||||
},
|
||||
addTaskGanttAttributes() {
|
||||
this.theTasks.map(t => {
|
||||
t.endDate === null ? this.endDate : t.endDate
|
||||
t.durationDays = Math.floor((t.endDate - t.startDate) / 1000 / 60 / 60 / 24) + 1
|
||||
t.offsetDays = Math.floor((t.startDate - this.startDate) / 1000 / 60 / 60 / 24) + 1
|
||||
return t
|
||||
})
|
||||
addGantAttributes(t) {
|
||||
t.endDate === null ? this.endDate : t.endDate
|
||||
t.durationDays = Math.floor((t.endDate - t.startDate) / 1000 / 60 / 60 / 24) + 1
|
||||
t.offsetDays = Math.floor((t.startDate - this.startDate) / 1000 / 60 / 60 / 24) + 1
|
||||
return t
|
||||
},
|
||||
sortTasks() {
|
||||
this.theTasks
|
||||
.sort(function(a,b) {
|
||||
this.theTasks = this.theTasks.sort(function(a,b) {
|
||||
if (a.startDate < b.startDate)
|
||||
return -1
|
||||
if (a.startDate > b.startDate)
|
||||
|
@ -199,8 +198,6 @@
|
|||
|
||||
this.taskService.update(this.taskDragged)
|
||||
.then(r => {
|
||||
this.taskDragged = r
|
||||
|
||||
// If the task didn't have dates before, we'll update the list
|
||||
if(didntHaveDates) {
|
||||
for (const t in this.tasksWithoutDates) {
|
||||
|
@ -208,9 +205,8 @@
|
|||
this.tasksWithoutDates.splice(t, 1)
|
||||
}
|
||||
}
|
||||
this.theTasks.push(r)
|
||||
this.theTasks.push(this.addGantAttributes(r))
|
||||
this.sortTasks()
|
||||
this.addTaskGanttAttributes()
|
||||
}
|
||||
|
||||
message.success({message: 'The task was successfully updated.'}, this)
|
||||
|
|
Reference in New Issue
Block a user