Skip to content

Commit

Permalink
Fix rounded value of recovered overtime
Browse files Browse the repository at this point in the history
  • Loading branch information
yannlugrin committed Jul 5, 2023
1 parent 38b43ba commit 64347ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pages/api/summaries/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const handler = async (
formationExpenses: row[4],
justifiedAbsence: Number(row[5]),
overtimeRecovery: Number(row[6]),
overtimePaid: Number(row[7]) * HOURS_PER_DAY,
overtimePaid: Number(row[7]),
workingPercent: Number(row[8]),
overtimeRemaining: Number(row[9]),
vacationPreviousYearRemaining: Number(row[11]),
Expand Down
9 changes: 3 additions & 6 deletions pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const Dashboard = () => {
const { data: summary, isLoading } = useSummary();

const remainingOverTimeDays = summary
? summary.overtimeRemaining / HOURS_PER_DAY
? Number((summary.overtimeRemaining / HOURS_PER_DAY).toFixed(2))
: 0;

const totalOvertimeRecoveryDays = summary
? (summary.overtimeRemaining + summary.overtimePaid) / HOURS_PER_DAY
? Number((summary.overtimeRecovery + summary.overtimePaid).toFixed(2))
: 0;

const currentYear = new Date().getFullYear();
Expand Down Expand Up @@ -50,10 +50,7 @@ const Dashboard = () => {
'jour'
)} de vacances`}</p>
<p>
{`${pluralize(
Number(remainingOverTimeDays.toFixed(2)),
'jour'
)}
{`${pluralize(remainingOverTimeDays, 'jour')}
(${summary.overtimeRemaining}h) supplémentaires`}
</p>
</div>
Expand Down

0 comments on commit 64347ec

Please sign in to comment.