Merge pull request #1893 from stackernews/fix-welcome-script

Fix NaN in welcome script
This commit is contained in:
ekzyis 2025-02-10 16:04:20 +01:00 committed by GitHub
commit 1ce88a216a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,7 +109,11 @@ async function populate (bios) {
bio.user.items = await fetchUserItems(bio.user.name) bio.user.items = await fetchUserItems(bio.user.name)
bio.user.credits = sumBy(bio.user.items, 'credits') bio.user.credits = sumBy(bio.user.items, 'credits')
bio.user.sats = sumBy(bio.user.items, 'sats') - bio.user.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 return bio
} }
) )