From a913c2d4524515164ab49bc3fcdbf53e067768b5 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 10 Feb 2025 01:39:13 +0100 Subject: [PATCH] Fix NaN in welcome script --- scripts/welcome.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/welcome.js b/scripts/welcome.js index 6d487950..f4d63ee3 100755 --- a/scripts/welcome.js +++ b/scripts/welcome.js @@ -109,7 +109,11 @@ async function populate (bios) { bio.user.items = await fetchUserItems(bio.user.name) bio.user.credits = sumBy(bio.user.items, 'credits') bio.user.sats = sumBy(bio.user.items, 'sats') - bio.user.credits - bio.user.satstandard = bio.user.sats / (bio.user.sats + bio.user.credits) + if (bio.user.sats > 0 || bio.user.credits > 0) { + bio.user.satstandard = bio.user.sats / (bio.user.sats + bio.user.credits) + } else { + bio.user.satstandard = 0 + } return bio } )