From 665cc4b98fdb8ec8945b590deae9504a5ee1685c Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 4 Apr 2024 16:48:19 -0400 Subject: [PATCH] Clean up us-election --- commands/events/us-election.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/events/us-election.js b/commands/events/us-election.js index 5a2d7209..ff453435 100644 --- a/commands/events/us-election.js +++ b/commands/events/us-election.js @@ -49,8 +49,8 @@ module.exports = class UsElectionCommand extends Command { if (name) name = name[1]; else name = 'Other'; const score = tables.eq(i).children().eq(1).children().first().text().trim(); - const percentChange = tables.eq(i).children().eq(1).children().eq(1).text().trim() || '-0.0%'; - canidates.push({ name, score, percentChange }); + const percentChange = Number.parseFloat(tables.eq(i).children().eq(1).children().eq(1).text().trim() || 0); + canidates.push({ name, score, percentChange: `${percentChange > 0 ? '+' : ''}${percentChange}%` }); } return canidates; }