Merge pull request #15714 from ramonlsouza/port-15687-25
fix: multiple answer translation in live results (2.5)
This commit is contained in:
commit
ca52a2e073
@ -79,11 +79,16 @@ class LiveResult extends PureComponent {
|
||||
if (responses) {
|
||||
const response = responses.find(r => r.userId === user.userId);
|
||||
if (response) {
|
||||
const answerKeys = [];
|
||||
const formattedAnswers = [];
|
||||
response.answerIds.forEach((answerId) => {
|
||||
answerKeys.push(answers[answerId].key);
|
||||
const formattedMessageIndex = answers[answerId].key.toLowerCase();
|
||||
const formattedAnswer = defaultPoll && pollAnswerIds[formattedMessageIndex]
|
||||
? intl.formatMessage(pollAnswerIds[formattedMessageIndex])
|
||||
: answers[answerId].key;
|
||||
|
||||
formattedAnswers.push(formattedAnswer);
|
||||
});
|
||||
answer = answerKeys.join(', ');
|
||||
answer = formattedAnswers.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,18 +99,13 @@ class LiveResult extends PureComponent {
|
||||
})
|
||||
.sort(Service.sortUsers)
|
||||
.reduce((acc, user) => {
|
||||
const formattedMessageIndex = user.answer.toLowerCase();
|
||||
return ([
|
||||
...acc,
|
||||
(
|
||||
<tr key={_.uniqueId('stats-')}>
|
||||
<Styled.ResultLeft>{user.name}</Styled.ResultLeft>
|
||||
<Styled.ResultRight data-test="receivedAnswer">
|
||||
{
|
||||
defaultPoll && pollAnswerIds[formattedMessageIndex]
|
||||
? intl.formatMessage(pollAnswerIds[formattedMessageIndex])
|
||||
: user.answer
|
||||
}
|
||||
{user.answer}
|
||||
</Styled.ResultRight>
|
||||
</tr>
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user