From 2301392ba4d09d3840959dfd1756774a7c9226ce Mon Sep 17 00:00:00 2001 From: ashley Date: Mon, 10 Jun 2024 21:29:10 +0000 Subject: [PATCH] add likePercentage :3 --- html/poketube.ejs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/html/poketube.ejs b/html/poketube.ejs index 60429f75..870499ac 100644 --- a/html/poketube.ejs +++ b/html/poketube.ejs @@ -1376,6 +1376,17 @@ WIP! Date of upload: <%=date%> ^^

Rating : <%=engagement.rating.toLocaleString()%> (<%=engagement.dislikes.toLocaleString()%>/<%=engagement.likes.toLocaleString()%> LTDR)
+ + <% + const likes = parseInt(engagement.likes) || 0; + const dislikes = parseInt(engagement.dislikes) || 0; + const total = likes + dislikes; + + const likePercentage = total > 0 ? ((likes / total) * 100).toFixed(2) + '%' : '0%'; + const dislikePercentage = total > 0 ? ((dislikes / total) * 100).toFixed(2) + '%' : '0%'; + %> + + <%= likePercentage %> of the users lieked the video!! RYD date created : <%=engagement.dateCreated.toLocaleString()%>
See in json