fix no reset
This commit is contained in:
@@ -39,8 +39,8 @@ const duration = computed(() => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// When in pause, it can be a tick where now
|
// When in pause, it can happen to
|
||||||
// is behind new Date().
|
// have a tick where now is behind new Date().
|
||||||
const mostRecentDate = new Date(
|
const mostRecentDate = new Date(
|
||||||
Math.max(new Date(now.value).getTime(), new Date().getTime())
|
Math.max(new Date(now.value).getTime(), new Date().getTime())
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import RecordResume from '@/modules/record/components/RecordResume.vue'
|
|||||||
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||||
import { formatLongDate } from '@/shared/format-date'
|
import { formatLongDate } from '@/shared/format-date'
|
||||||
import { useLoopyTitle } from '@/shared/useLoopyTitle'
|
import { useLoopyTitle } from '@/shared/useLoopyTitle'
|
||||||
import { computed } from 'vue'
|
import { computed, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
||||||
import RecordControls from './RecordControls.vue'
|
import RecordControls from './RecordControls.vue'
|
||||||
@@ -21,10 +21,12 @@ const router = useRouter()
|
|||||||
|
|
||||||
const task = computed(() => taskStore.getTask(props.taskId))
|
const task = computed(() => taskStore.getTask(props.taskId))
|
||||||
|
|
||||||
if (task.value) {
|
onMounted(() => {
|
||||||
recordStore.syncTaskRecord(task.value)
|
if (task.value) {
|
||||||
}
|
recordStore.syncTaskRecord(task.value)
|
||||||
recordStore.addRecord(props.taskId)
|
}
|
||||||
|
recordStore.initRecord(props.taskId)
|
||||||
|
})
|
||||||
|
|
||||||
useLoopyTitle(task.value?.title ?? '')
|
useLoopyTitle(task.value?.title ?? '')
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
|||||||
|
|
||||||
const record = this.records[task.id]
|
const record = this.records[task.id]
|
||||||
|
|
||||||
const taskRecordStepIds = Object.keys(record)
|
const taskRecordStepIds = Object.keys(record.stepRecords)
|
||||||
const taskStepIds = new Set(task.steps.map((step) => step.id))
|
const taskStepIds = new Set(task.steps.map((step) => step.id))
|
||||||
|
|
||||||
const hasSameSteps =
|
const hasSameSteps =
|
||||||
@@ -36,7 +36,7 @@ export const useTaskRecordStore = defineStore('task-record-store', {
|
|||||||
this.records[task.id] = new TaskRecord(task.id)
|
this.records[task.id] = new TaskRecord(task.id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addRecord(taskId: string) {
|
initRecord(taskId: string) {
|
||||||
if (taskId in this.records) {
|
if (taskId in this.records) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user