fix: refactor le calcul de totalHours dans le composant Stats

This commit is contained in:
2026-01-04 19:57:42 +01:00
parent 4cda11a6a3
commit 669eec60a1

View File

@@ -5,7 +5,12 @@ import { usePrecision } from '@vueuse/math'
const { data: stats } = await useAsyncData<Stats>('stats', () => $fetch('/api/stats'))
const startDate = computed(() => new Date(stats.value?.coding?.range?.start ?? new Date()))
const totalHours = usePrecision((stats.value?.coding?.grand_total?.total_seconds_including_other_language ?? 0) / 3600, 0)
const rawHours = computed(() => {
const seconds = stats.value?.coding?.grand_total?.total_seconds_including_other_language ?? 0
return seconds / 3600
})
const totalHours = usePrecision(rawHours.value, 0)
const yearsCollected = useTimeAgo(startDate)
const formattedDate = useDateFormat(startDate, 'MMM DD, YYYY')