Skip to content

Commit

Permalink
Fix NaN rating in ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreasgdp committed Oct 14, 2023
1 parent a150991 commit 6a32640
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/components/recipeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function RecipeView({
});

function calculateRating(ratings: RecipeRating[]) {
if (ratings.length === 0) return 0;
return (
ratings.reduce((acc, curr) => acc + curr.rating, 0) / ratings.length
).toFixed(1);
Expand Down

1 comment on commit 6a32640

@vercel
Copy link

@vercel vercel bot commented on 6a32640 Oct 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mealtime – ./

mealtime-git-master-mealtime.vercel.app
momentmeal.com
mealtime-mealtime.vercel.app
www.momentmeal.com

Please sign in to comment.