mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-23 01:53:51 +02:00
Clean up us-election
This commit is contained in:
@@ -49,8 +49,8 @@ module.exports = class UsElectionCommand extends Command {
|
|||||||
if (name) name = name[1];
|
if (name) name = name[1];
|
||||||
else name = 'Other';
|
else name = 'Other';
|
||||||
const score = tables.eq(i).children().eq(1).children().first().text().trim();
|
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%';
|
const percentChange = Number.parseFloat(tables.eq(i).children().eq(1).children().eq(1).text().trim() || 0);
|
||||||
canidates.push({ name, score, percentChange });
|
canidates.push({ name, score, percentChange: `${percentChange > 0 ? '+' : ''}${percentChange}%` });
|
||||||
}
|
}
|
||||||
return canidates;
|
return canidates;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user