results: <DecryptedVotes /> respect type: 'ranked-choice-irv'

This commit is contained in:
David Ernst
2023-07-18 20:31:52 -07:00
parent 7318e37e1d
commit de38ebb4fc

View File

@@ -1,5 +1,6 @@
import { orderBy } from 'lodash-es'
import { flatten } from 'lodash-es'
import { defaultRankingsAllowed } from 'src/vote/RankedChoiceItem'
import { unTruncateSelection } from './un-truncate-selection'
import { useDecryptedVotes } from './use-decrypted-votes'
@@ -14,11 +15,13 @@ export const DecryptedVotes = ({ proofsPage }: { proofsPage?: boolean }): JSX.El
const sorted_votes = orderBy(votes, 'tracking')
const columns = flatten(
ballot_design.map(({ id, multiple_votes_allowed }) => {
return multiple_votes_allowed
? new Array(multiple_votes_allowed).fill('').map((_, index) => `${id || 'vote'}_${index + 1}`)
: id || 'vote'
}),
ballot_design?.map(({ id, multiple_votes_allowed, type }) =>
multiple_votes_allowed || type === 'ranked-choice-irv'
? new Array(multiple_votes_allowed || defaultRankingsAllowed)
.fill('')
.map((_, index) => `${id || 'vote'}_${index + 1}`)
: id || 'vote',
),
)
return (