diff --git a/configs/dashboard.tsx b/configs/dashboard.tsx index a2e4843..072e072 100644 --- a/configs/dashboard.tsx +++ b/configs/dashboard.tsx @@ -1,7 +1,7 @@ export const SHEET_NAME = `résumé-${new Date().getFullYear()}`; export const RANGE_START = 'A'; -export const RANGE_END = 'P'; +export const RANGE_END = 'Q'; export const HOURS_PER_DAY = 8.4; export const FORMATION_BUDGET = 5; diff --git a/interfaces/summary.ts b/interfaces/summary.ts index 1738227..10dbdc2 100644 --- a/interfaces/summary.ts +++ b/interfaces/summary.ts @@ -11,6 +11,7 @@ export default interface Summary { overtime: number; overtimeRecovery: number; overtimePaid: number; + overtimePreviousYearRemaining: number; overtimeRemaining: number; vacation: number; diff --git a/pages/api/summaries/me.ts b/pages/api/summaries/me.ts index b921c3e..49fea51 100644 --- a/pages/api/summaries/me.ts +++ b/pages/api/summaries/me.ts @@ -40,12 +40,13 @@ const handler = async ( overtimeRecovery: Number(row[6]), overtimePaid: Number(row[7]), workingPercent: Number(row[8]), - overtimeRemaining: Number(row[9]), - vacationPreviousYearRemaining: Number(row[11]), - vacationCurrentYear: Number(row[12]), - vacationBalance: Number(row[13]), - remainingDaysToTake: Number(row[14]), - email: row[15], + overtimePreviousYearRemaining: Number(row[9]), + overtimeRemaining: Number(row[10]), + vacationPreviousYearRemaining: Number(row[12]), + vacationCurrentYear: Number(row[13]), + vacationBalance: Number(row[14]), + remainingDaysToTake: Number(row[15]), + email: row[16], })) .slice(1); // Remove header diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index 89498e2..cbb340a 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -18,9 +18,15 @@ const Dashboard = () => { : 0; const totalOvertimeRecoveryDays = summary - ? Number((summary.overtimeRecovery + summary.overtimePaid).toFixed(2)) + ? summary.overtimeRecovery + summary.overtimePaid : 0; + const totalOverTime = summary + ? summary.overtime + summary.overtimePreviousYearRemaining * HOURS_PER_DAY + : 0; + + const totalOverTimeDays = Number((totalOverTime / HOURS_PER_DAY).toFixed(2)); + const currentYear = new Date().getFullYear(); return ( @@ -73,8 +79,8 @@ const Dashboard = () => { }, { label: 'Heures supplémentaires totales', - value: summary?.overtime, - metric: 'h', + value: totalOverTimeDays, + metric: 'j', }, ]} />