From e36e8c86543a99b24f6b550fbf5038411fc62193 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Tue, 12 Oct 2021 20:50:58 +0200 Subject: [PATCH] Update TaskUtil --- app/Utils/StatsUtils.ts | 126 +++++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 48 deletions(-) diff --git a/app/Utils/StatsUtils.ts b/app/Utils/StatsUtils.ts index 9765efa..a16e21a 100644 --- a/app/Utils/StatsUtils.ts +++ b/app/Utils/StatsUtils.ts @@ -3,122 +3,152 @@ import CommandsRun from "App/Models/CommandsRun"; import BuildsRun from "App/Models/BuildsRun"; interface Stats { - start: Date - end: Date + range: { + start: string + end: string + } - development_seconds: number + development_time: Time commands_ran: number builds_ran: number } -export async function getDevelopmentHours(start: Date, end: Date): Promise { - const development_seconds = await DevelopmentHour +interface Time { + total_hours: number + total_minutes: number + total_seconds: number +} + +function formatDate(date: Date): string { + return date.toISOString().split('T')[0] +} + +export const NOW = formatDate(new Date()) + +export async function getDevelopmentHours(start: string, end: string): Promise