This commit is contained in:
parent
59bfacc771
commit
2810618101
|
@ -150,9 +150,7 @@
|
|||
},
|
||||
parseTasks() {
|
||||
this.setDates()
|
||||
// The following three are split up in different functions to be able to call them independently
|
||||
this.prepareTasks()
|
||||
this.sortTasks()
|
||||
},
|
||||
prepareTasks() {
|
||||
this.theTasks = this.tasks
|
||||
|
@ -165,15 +163,7 @@
|
|||
.map(t => {
|
||||
return this.addGantAttributes(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) {
|
||||
.sort(function(a,b) {
|
||||
if (a.startDate < b.startDate)
|
||||
return -1
|
||||
if (a.startDate > b.startDate)
|
||||
|
@ -181,6 +171,12 @@
|
|||
return 0
|
||||
})
|
||||
},
|
||||
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
|
||||
},
|
||||
resizeTask(newRect) {
|
||||
let didntHaveDates = this.taskDragged.startDate === null ? true : false
|
||||
|
||||
|
@ -206,7 +202,6 @@
|
|||
}
|
||||
}
|
||||
this.theTasks.push(this.addGantAttributes(r))
|
||||
this.sortTasks()
|
||||
}
|
||||
|
||||
message.success({message: 'The task was successfully updated.'}, this)
|
||||
|
|
Reference in New Issue
Block a user