fix record resume total duration
This commit is contained in:
@@ -8,7 +8,8 @@ const props = defineProps<{
|
|||||||
totalEstimation: number
|
totalEstimation: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { duration } = useTaskRecordMetadata(props.record)
|
const record = computed(() => props.record)
|
||||||
|
const { duration } = useTaskRecordMetadata(record)
|
||||||
|
|
||||||
const isSuperiorToEstimation = computed(() => {
|
const isSuperiorToEstimation = computed(() => {
|
||||||
if (!duration.value) {
|
if (!duration.value) {
|
||||||
@@ -32,8 +33,3 @@ const isSuperiorToEstimation = computed(() => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.record-resume {
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import type { Recordable } from '@/modules/record/interfaces/recordable'
|
import type { Recordable } from '@/modules/record/interfaces/recordable'
|
||||||
import { formatDiffInMinutes } from '@/shared/format-date'
|
import { formatDiffInMinutes } from '@/shared/format-date'
|
||||||
import { computed, isRef, type Ref } from 'vue'
|
import { toValue } from '@vueuse/core'
|
||||||
|
import { computed, type ComputedRef } from 'vue'
|
||||||
|
|
||||||
export const useTaskRecordMetadata = (
|
export const useTaskRecordMetadata = (
|
||||||
record: Recordable | Ref<Recordable | null>
|
record: ComputedRef<Recordable | null>
|
||||||
) => {
|
) => {
|
||||||
const taskDurations = computed(() => {
|
const taskDurations = computed(() => {
|
||||||
const recordValue = isRef(record) ? record.value : record
|
const recordValue = toValue(record)
|
||||||
|
|
||||||
if (!recordValue?.end) {
|
if (!recordValue?.end) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const finishedTaskDurations = Object.values(recordValue.stepRecords)
|
const finishedTaskDurations = Object.values(recordValue.stepRecords)
|
||||||
.filter((record) => !!record.end)
|
.filter((r) => !!r.end)
|
||||||
.map((record) => formatDiffInMinutes(record.start, record.end!))
|
.map((record) => formatDiffInMinutes(record.start, record.end!))
|
||||||
|
|
||||||
return finishedTaskDurations
|
return finishedTaskDurations
|
||||||
|
|||||||
Reference in New Issue
Block a user