calculate poll vote pct on current votes - live result

This commit is contained in:
Ramón Souza 2021-10-08 11:42:58 +00:00
parent b86b5d252c
commit 8eb274f8ae

View File

@ -56,7 +56,7 @@ class LiveResult extends PureComponent {
if (!currentPoll) return null;
const {
answers, responses, users, numRespondents, pollType
answers, responses, users, numResponders, pollType
} = currentPoll;
const defaultPoll = isDefaultPoll(pollType);
@ -105,7 +105,7 @@ class LiveResult extends PureComponent {
answers.reduce(caseInsensitiveReducer, []).map((obj) => {
const formattedMessageIndex = obj.key.toLowerCase();
const pct = Math.round(obj.numVotes / numRespondents * 100);
const pct = Math.round(obj.numVotes / numResponders * 100);
const pctFotmatted = `${Number.isNaN(pct) ? 0 : pct}%`;
const calculatedWidth = {