diff --git a/src/poll.ts b/src/poll.ts index 626e512..590b7cb 100644 --- a/src/poll.ts +++ b/src/poll.ts @@ -49,14 +49,15 @@ export const renderPoll = async (card: TweetCard): Promise => { } } 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)}%) `; }