Skip to content

Commit

Permalink
Fixed bug in review score rendering (#949)
Browse files Browse the repository at this point in the history
* Fixed bug in review score rendering

* chore(frontend): use `null` in place of `undefined`

---------

Co-authored-by: Diptesh Choudhuri <[email protected]>
  • Loading branch information
Jacob-Tate and IgnisDa authored Aug 9, 2024
1 parent 2d4da19 commit ce75b95
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions apps/frontend/app/components/media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,11 @@ export const MetadataDisplayItem = (props: {
<Group gap={4}>
<IconStarFilled size={12} style={{ color: "#EBE600FF" }} />
<Text c="white" size="xs" fw="bold" pr={4}>
{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
: " %"}
</Text>
</Group>
Expand Down

0 comments on commit ce75b95

Please sign in to comment.