Skip to content

Commit 5af2740

Browse files
committed
Fix confirm modal answers
1 parent b56bb95 commit 5af2740

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/Process/ConfirmVoteModal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const ConfirmVoteModal = ({ elections, answers }: QuestionsConfirmationPr
2121
const canAbstain =
2222
election.resultsType.name === ElectionResultsTypeNames.MULTIPLE_CHOICE &&
2323
election.resultsType.properties.canAbstain
24+
const eAnswers = answers[election.id]
2425
return (
2526
<>
2627
<Flex
@@ -54,7 +55,7 @@ export const ConfirmVoteModal = ({ elections, answers }: QuestionsConfirmationPr
5455
span: <Text as='span' fontWeight='bold' whiteSpace='nowrap' />,
5556
}}
5657
values={{
57-
answer: q.choices[Number(answers[i])].title.default,
58+
answer: q.choices[Number(eAnswers[i])].title.default,
5859
number: i + 1,
5960
}}
6061
/>
@@ -68,9 +69,9 @@ export const ConfirmVoteModal = ({ elections, answers }: QuestionsConfirmationPr
6869
}}
6970
values={{
7071
answers:
71-
answers[0].length === 0
72+
eAnswers[0].length === 0
7273
? t('process.spreadsheet.confirm.blank_vote')
73-
: answers[0]
74+
: eAnswers[0]
7475
.map((a: string) => q.choices[Number(a)].title.default)
7576
.map((a: string) => `- ${a}`)
7677
.join('<br />'),
@@ -83,12 +84,12 @@ export const ConfirmVoteModal = ({ elections, answers }: QuestionsConfirmationPr
8384
</Box>
8485
))}
8586
</Flex>
86-
{canAbstain && answers[0].length < election.voteType.maxCount! && (
87+
{canAbstain && eAnswers[0].length < election.voteType.maxCount! && (
8788
<Flex direction={'row'} py={2} gap={2} alignItems={'center'} color={'primary.main'}>
8889
<IoWarningOutline />
8990
<Text display='flex' flexDirection='column' gap={1}>
9091
{t('process.spreadsheet.confirm.abstain_count', {
91-
count: election.voteType.maxCount! - answers[0].length,
92+
count: election.voteType.maxCount! - eAnswers[0].length,
9293
})}
9394
</Text>
9495
</Flex>

0 commit comments

Comments
 (0)