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 fdf2192
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ 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) /
HOURS_PER_DAY
).toFixed(2)
)
: 0;

const currentYear = new Date().getFullYear();
Expand Down Expand Up @@ -50,10 +55,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 fdf2192

Please sign in to comment.