Skip to content

Commit

Permalink
Prevent division by 0 in charts % calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Minnowo committed Jan 2, 2025
1 parent ef77979 commit 9dbff68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ui/src/dashboard/Entry/DashboardPieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const CustomTooltip = ({active, payload, total}: CustomTooltipProps) => {
<Paper style={{padding: 10}} elevation={4}>
<Typography>
{first.payload.key}:{first.payload.value}: {prettyMs(first.payload.timeSpendInSeconds * 1000)} (
{((first.payload.timeSpendInSeconds / total) * 100).toFixed(2)}%)
{total > 0 ? ((first.payload.timeSpendInSeconds / total) * 100).toFixed(2) : '0.00'}%)
</Typography>
</Paper>
);
Expand Down

0 comments on commit 9dbff68

Please sign in to comment.