mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-04 10:00:55 +01:00
Try Math.round instead of Math.floor
This commit is contained in:
parent
9cb2753747
commit
3cc6a3e674
1 changed files with 3 additions and 2 deletions
|
@ -49,14 +49,15 @@ export const renderPoll = async (card: TweetCard): Promise<string> => {
|
|||
}
|
||||
} else {
|
||||
console.log('no choices found', values);
|
||||
return '';
|
||||
}
|
||||
console.log(choices);
|
||||
|
||||
for (const [label, votes] of Object.entries(choices)) {
|
||||
// render bar
|
||||
const bar = '█'.repeat(Math.floor((votes / totalVotes || 0) * barLength));
|
||||
const bar = '█'.repeat(Math.round((votes / totalVotes || 0) * barLength));
|
||||
str += `${bar}
|
||||
${label} (${Math.floor((votes / totalVotes || 0) * 100)}%)
|
||||
${label} (${Math.round((votes / totalVotes || 0) * 100)}%)
|
||||
`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue