diff --git a/bbb-learning-dashboard/src/components/UserDetails/component.jsx b/bbb-learning-dashboard/src/components/UserDetails/component.jsx index 28897e0eae..d3510af62b 100644 --- a/bbb-learning-dashboard/src/components/UserDetails/component.jsx +++ b/bbb-learning-dashboard/src/components/UserDetails/component.jsx @@ -174,47 +174,57 @@ const UserDatailsComponent = (props) => { function renderPollItem(poll, answers) { const { anonymous: isAnonymous, question, pollId } = poll; - const mostCommomAnswer = Object + const answersSorted = Object .entries(pollVotesCount[pollId]) - .sort(([, countA], [, countB]) => countB - countA)[0]?.[0]; + .sort(([, countA], [, countB]) => countB - countA); + let mostCommonAnswer = answersSorted[0]?.[0]; + const mostCommonAnswerCount = answersSorted[0]?.[1]; + + if (mostCommonAnswer && mostCommonAnswerCount) { + const hasDraw = answersSorted[1]?.[1] === mostCommonAnswerCount; + if (hasDraw) mostCommonAnswer = null; + } return (
{question}
{ isAnonymous ? ( - - - - - + + + + +
) : (
{answers.map((answer) =>

{answer}

)}
) }
- { mostCommomAnswer - ? `${String.fromCharCode(mostCommomAnswer.charCodeAt(0) - 32)}${mostCommomAnswer.substring(1)}` + { mostCommonAnswer + ? `${String.fromCharCode(mostCommonAnswer.charCodeAt(0) - 32)}${mostCommonAnswer.substring(1)}` : intl.formatMessage({ id: 'app.learningDashboard.usersTable.notAvailable', defaultMessage: 'N/A',