From ce75b95d2426a321f5ca80471bc1c0e1f5b9d973 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 8 Aug 2024 17:35:55 -0700 Subject: [PATCH] Fixed bug in review score rendering (#949) * Fixed bug in review score rendering * chore(frontend): use `null` in place of `undefined` --------- Co-authored-by: Diptesh Choudhuri --- apps/frontend/app/components/media.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/apps/frontend/app/components/media.tsx b/apps/frontend/app/components/media.tsx index a801509de0..d4788bdb14 100644 --- a/apps/frontend/app/components/media.tsx +++ b/apps/frontend/app/components/media.tsx @@ -601,14 +601,11 @@ export const MetadataDisplayItem = (props: { - {match(userPreferences.general.reviewScale) - .with(UserReviewScale.OutOfFive, () => - Number.parseFloat(averageRating.toString()).toFixed(1), - ) - .with(UserReviewScale.OutOfHundred, () => averageRating) - .exhaustive()} + {Number(averageRating) % 1 === 0 + ? Math.round(Number(averageRating)).toString() + : Number(averageRating).toFixed(1)} {userPreferences.general.reviewScale === UserReviewScale.OutOfFive - ? undefined + ? null : " %"}