fix(step edit): start date is now set to the latest start date instead of new Date()
This commit is contained in:
@@ -202,6 +202,12 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (nextStepIndex >= 0) {
|
if (nextStepIndex >= 0) {
|
||||||
|
const latestStartDate = Math.max(
|
||||||
|
...Object.values(record.stepRecords).map((stepRecord) =>
|
||||||
|
new Date(stepRecord.start).getTime()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
task.steps
|
task.steps
|
||||||
.filter((_, index) => index > nextStepIndex)
|
.filter((_, index) => index > nextStepIndex)
|
||||||
.map((step) => step.id)
|
.map((step) => step.id)
|
||||||
@@ -212,7 +218,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
|||||||
this.startStepRecord({
|
this.startStepRecord({
|
||||||
taskId: task.id,
|
taskId: task.id,
|
||||||
stepId: task.steps[nextStepIndex].id,
|
stepId: task.steps[nextStepIndex].id,
|
||||||
start: toISODate(new Date())
|
start: toISODate(new Date(latestStartDate))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user