a message when finished and access to old records
This commit is contained in:
@@ -34,7 +34,6 @@ const duration = computed(() => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: diff in minutes not in seconds
|
|
||||||
return formatDiffInMinutes(
|
return formatDiffInMinutes(
|
||||||
stepRecord.value.start,
|
stepRecord.value.start,
|
||||||
stepRecord.value?.end ?? now.value
|
stepRecord.value?.end ?? now.value
|
||||||
@@ -59,11 +58,14 @@ const isSuperiorToEstimation = computed(() => {
|
|||||||
<span v-if="isSuperiorToEstimation">⚠️</span>
|
<span v-if="isSuperiorToEstimation">⚠️</span>
|
||||||
{{ duration }} minutes
|
{{ duration }} minutes
|
||||||
</td>
|
</td>
|
||||||
<td v-else>NA</td>
|
<td v-else></td>
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.step-record {
|
.step-record {
|
||||||
|
&.current {
|
||||||
|
background-color: rgb(4, 62, 62);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||||
import { formatDate } from '@/shared/format-date'
|
import { formatDate, formatDiffInMinutes } from '@/shared/format-date'
|
||||||
import { toISODate } from '@/shared/types/date'
|
import { toISODate } from '@/shared/types/date'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
||||||
@@ -68,12 +68,29 @@ const nextStep = () => {
|
|||||||
tick: toISODate(new Date())
|
tick: toISODate(new Date())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const duration = computed(() => {
|
||||||
|
if (!record.value?.end) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatDiffInMinutes(record.value.start, record.value?.end)
|
||||||
|
})
|
||||||
|
|
||||||
|
const isSuperiorToEstimation = computed(() => {
|
||||||
|
if (!task.value || !record.value || !duration.value) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return duration.value > task.value.totalEstimation
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="task-record" v-if="task">
|
<main class="task-record" v-if="task">
|
||||||
<h1>Task: {{ task.title }}</h1>
|
<h1>Task: {{ task.title }}</h1>
|
||||||
<h2>start time: {{ formatDate(record.start) }}</h2>
|
<h2>start time: {{ formatDate(record.start) }}</h2>
|
||||||
|
<template v-if="!record.end">
|
||||||
<button
|
<button
|
||||||
v-if="!recordStore.currentStepId && !record.hasStepRecords"
|
v-if="!recordStore.currentStepId && !record.hasStepRecords"
|
||||||
@click="startRecording"
|
@click="startRecording"
|
||||||
@@ -81,12 +98,14 @@ const nextStep = () => {
|
|||||||
start
|
start
|
||||||
</button>
|
</button>
|
||||||
<button v-else @click="nextStep">next</button>
|
<button v-else @click="nextStep">next</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
<button @click="recordStore.$reset">reset</button>
|
<button @click="recordStore.$reset">reset</button>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Task</th>
|
<th>task</th>
|
||||||
<th>estimation</th>
|
<th>estimation</th>
|
||||||
<th>actual</th>
|
<th>actual</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -102,17 +121,22 @@ const nextStep = () => {
|
|||||||
/>
|
/>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div v-if="record.end">
|
||||||
|
<hr />
|
||||||
|
The task took {{ duration }} minutes instead of
|
||||||
|
{{ task.totalEstimation }} minutes.
|
||||||
|
<span>
|
||||||
|
<span v-if="isSuperiorToEstimation">More</span><span v-else>Less</span>
|
||||||
|
than expected.
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.task-record {
|
.task-record {
|
||||||
.current {
|
table {
|
||||||
background-color: red;
|
width: 100%;
|
||||||
}
|
|
||||||
|
|
||||||
.estimation {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { createUuid } from '@/shared/create-uuid'
|
import { createUuid } from '@/shared/create-uuid'
|
||||||
|
import { formatDate } from '@/shared/format-date'
|
||||||
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
import { useTaskRecordStore } from '../stores/useTaskRecordStore'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@@ -13,11 +14,17 @@ const newRecordId = createUuid()
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ul v-if="records.length" class="task-record-list">
|
<ol v-if="records.length" class="task-record-list">
|
||||||
<li v-for="record in records" :key="record.id">
|
<li v-for="record in records" :key="record.id">
|
||||||
{{ record }}
|
<router-link
|
||||||
|
:to="{
|
||||||
|
name: 'record-view',
|
||||||
|
params: { taskId, recordId: record.id }
|
||||||
|
}"
|
||||||
|
>{{ formatDate(record.start) }}</router-link
|
||||||
|
>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ol>
|
||||||
<div v-else>No record yet</div>
|
<div v-else>No record yet</div>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ export interface Recordable {
|
|||||||
* TODO: Compute this data from step records
|
* TODO: Compute this data from step records
|
||||||
*/
|
*/
|
||||||
start: ISODate
|
start: ISODate
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* TODO: Compute this data from step records
|
|
||||||
*/
|
|
||||||
end?: ISODate
|
end?: ISODate
|
||||||
stepRecords: Record<string, StepRecordable>
|
stepRecords: Record<string, StepRecordable>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { formatDiffInMinutes } from '@/shared/format-date'
|
|
||||||
import { toISODate, type ISODate } from '@/shared/types/date'
|
import { toISODate, type ISODate } from '@/shared/types/date'
|
||||||
import type { Recordable } from '../interfaces/recordable'
|
import type { Recordable } from '../interfaces/recordable'
|
||||||
import type { StepRecordable } from '../interfaces/step-recordable'
|
import type { StepRecordable } from '../interfaces/step-recordable'
|
||||||
@@ -13,14 +12,6 @@ export class TaskRecord implements Recordable {
|
|||||||
public readonly taskId: string
|
public readonly taskId: string
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public get duration(): number | null {
|
|
||||||
if (!this.end) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return formatDiffInMinutes(this.start, this.end)
|
|
||||||
}
|
|
||||||
|
|
||||||
public get hasStepRecords() {
|
public get hasStepRecords() {
|
||||||
return Object.values(this.stepRecords).length > 0
|
return Object.values(this.stepRecords).length > 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,6 @@ export const formatDate = (date: Date | string) =>
|
|||||||
|
|
||||||
export const formatDiffInMinutes = (date1: ISODate, date2: ISODate) => {
|
export const formatDiffInMinutes = (date1: ISODate, date2: ISODate) => {
|
||||||
const diffInMs = new Date(date2).getTime() - new Date(date1).getTime()
|
const diffInMs = new Date(date2).getTime() - new Date(date1).getTime()
|
||||||
|
// TODO: diff in minutes not in seconds
|
||||||
return Math.max(0, Math.round(diffInMs / 1000))
|
return Math.max(0, Math.round(diffInMs / 1000))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ const task = computed(() => taskStore.getTask(props.id))
|
|||||||
<div>{{ step.title }} | {{ step.estimation }}</div>
|
<div>{{ step.title }} | {{ step.estimation }}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<hr />
|
||||||
<task-record-list :task-id="id" />
|
<task-record-list :task-id="id" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else>Task not found</div>
|
<div v-else>Task not found</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user