fix: Fix ratio not appearing if downvotes are 0

This commit is contained in:
Xyphyn committed 2023-07-26 11:44:44 -07:00
1 parent bb8818b17b
commit 607fc7f837
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
<Card class="bg-white flex flex-col w-full p-5 gap-2.5"> <Card class="bg-white flex flex-col w-full p-5 gap-2.5">
<div class="flex flex-row w-full gap-2.5"> <div class="flex flex-row w-full gap-2.5">
<div class="flex flex-col gap-1 grow"> <div class="flex flex-col gap-1.5 grow">
<PostMeta <PostMeta
community={post.community} community={post.community}
user={post.creator} user={post.creator}
@@ -32,7 +32,7 @@
<span>•</span> <span>•</span>
{/if} {/if}
<RelativeDate date={published} /> <RelativeDate date={published} />
{#if upvotes && downvotes} {#if upvotes != undefined && downvotes != undefined}
<span>•</span> <span>•</span>
<span> <span>
{Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}% {Math.floor((upvotes / (upvotes + downvotes || 1)) * 100)}%