Clean up us-election

This commit is contained in:
Dragon Fire
2024-04-04 16:48:19 -04:00
parent 1a92f6f621
commit 665cc4b98f
+2 -2
View File
@@ -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;
}