From 001b9d66feae97e07625dc1c59792eb25cd601c4 Mon Sep 17 00:00:00 2001 From: DirtyRacer1337 Date: Wed, 2 Oct 2024 18:47:29 +0700 Subject: [PATCH 1/2] fix NaN --- plugins/stats/stats.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/stats/stats.js b/plugins/stats/stats.js index 39addc03..7011aae2 100644 --- a/plugins/stats/stats.js +++ b/plugins/stats/stats.js @@ -63,8 +63,7 @@ } // percentage helper - const percentage = (portion, total) => - ((portion / total) * 100).toFixed(2) + "%"; + const percentage = (portion, total) => (total > 0 ? (portion / total * 100).toFixed(2) : 0) + "%"; // *** actual stats fetching *** // performer of scenes with any StashID From 2db656943eed9ecbb849d04a681171d0e13a8c3f Mon Sep 17 00:00:00 2001 From: DirtyRacer1337 Date: Thu, 3 Oct 2024 16:34:19 +0700 Subject: [PATCH 2/2] format --- plugins/stats/stats.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/stats/stats.js b/plugins/stats/stats.js index 7011aae2..2079cd0c 100644 --- a/plugins/stats/stats.js +++ b/plugins/stats/stats.js @@ -63,7 +63,8 @@ } // percentage helper - const percentage = (portion, total) => (total > 0 ? (portion / total * 100).toFixed(2) : 0) + "%"; + const percentage = (portion, total) => + (total > 0 ? ((portion / total) * 100).toFixed(2) : 0) + "%"; // *** actual stats fetching *** // performer of scenes with any StashID