diff --git a/src/components/lists/TimeSpentTaskList.vue b/src/components/lists/TimeSpentTaskList.vue index 5299ef96d..c15f203f3 100644 --- a/src/components/lists/TimeSpentTaskList.vue +++ b/src/components/lists/TimeSpentTaskList.vue @@ -35,7 +35,9 @@ {{ task.name }} - {{ task.duration / 60 }} + + {{ getDuration(task) }} + @@ -51,8 +53,9 @@ import { mapGetters } from 'vuex' import { firstBy } from 'thenby' -import { sortByName } from '@/lib/sorting' import { getTaskPath } from '@/lib/path' +import { sortByName } from '@/lib/sorting' +import { hoursToDays } from '@/lib/time' import ProductionName from '@/components/widgets/ProductionName.vue' import TableInfo from '@/components/widgets/TableInfo.vue' @@ -85,11 +88,19 @@ export default { isError: { type: Boolean, default: false + }, + unit: { + type: String, + default: 'hour' } }, computed: { - ...mapGetters(['productionMap', 'taskTypeMap']), + ...mapGetters(['organisation', 'productionMap', 'taskTypeMap']), + + isHours() { + return this.unit === 'hour' + }, projects() { const projects = {} @@ -131,6 +142,13 @@ export default { }, methods: { + getDuration(task) { + const duration = task.duration / 60 + return this.isHours + ? duration + : hoursToDays(this.organisation, duration).toFixed(2) + }, + getTaskPath(task) { const project = this.productionMap.get(task.project_id) if (!project || project.project_status_name === 'Closed') { diff --git a/src/components/sides/PeopleTimesheetInfo.vue b/src/components/sides/PeopleTimesheetInfo.vue index 6ed8d6744..4c0e1ef55 100644 --- a/src/components/sides/PeopleTimesheetInfo.vue +++ b/src/components/sides/PeopleTimesheetInfo.vue @@ -36,6 +36,7 @@ :tasks="tasks" :is-loading="isLoading" :is-error="isLoadingError" + :unit="unit" /> @@ -96,6 +97,10 @@ export default { dayOffCount: { type: Number, default: 0 + }, + unit: { + type: String, + default: 'hour' } },