From b079abd217e42ecc61fb49e7c0a79845ffdaf5a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:05:02 +0000 Subject: [PATCH 1/2] Initial plan From aa8b4c547ca38feaef1f11332ce24de80a37a300 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Apr 2026 13:26:33 +0000 Subject: [PATCH 2/2] fix(ballot-verifier): align confirmation contest order with voting portal Agent-Logs-Url: https://github.com/sequentech/step/sessions/cab7fcec-43a8-4b79-b7fc-5f65deebcbfc Co-authored-by: Findeton <3913223+Findeton@users.noreply.github.com> --- .../src/screens/ConfirmationScreen.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/packages/ballot-verifier/src/screens/ConfirmationScreen.tsx b/packages/ballot-verifier/src/screens/ConfirmationScreen.tsx index 4bdc88ba90c..063692ba122 100644 --- a/packages/ballot-verifier/src/screens/ConfirmationScreen.tsx +++ b/packages/ballot-verifier/src/screens/ConfirmationScreen.tsx @@ -28,6 +28,7 @@ import { StyledButton, PlaintextVoteContest, } from "@sequentech/ui-essentials" +import {sortContestList} from "@sequentech/ui-core" import {keyBy} from "lodash" import {useElectionClassName} from "./hooks/useElectionClassName" import {SettingsContext} from "../providers/SettingsContextProvider" @@ -249,6 +250,26 @@ const VerifySelectionsSection: React.FC = ({ const [verifySelectionsHelp, setVerifySelectionsHelp] = useState(false) const plaintextVoteQuestions = confirmationBallot?.decoded_questions || [] const questionsMap = keyBy(confirmationBallot?.election_config.contests || [], "id") + const contestsOrderType = confirmationBallot?.election_config.election_presentation?.contests_order + const sortedPlaintextVoteQuestions = useMemo(() => { + if (!plaintextVoteQuestions.length) { + return [] + } + + const sortedContests = sortContestList( + confirmationBallot?.election_config.contests || [], + contestsOrderType + ) + const contestIndexMap = new Map( + sortedContests.map((contest, index) => [contest.id, index] as const) + ) + + return [...plaintextVoteQuestions].sort((a, b) => { + const firstIndex = contestIndexMap.get(a.contest_id) ?? Number.MAX_SAFE_INTEGER + const secondIndex = contestIndexMap.get(b.contest_id) ?? Number.MAX_SAFE_INTEGER + return firstIndex - secondIndex + }) + }, [confirmationBallot?.election_config.contests, contestsOrderType, plaintextVoteQuestions]) const {globalSettings} = useContext(SettingsContext) return ( @@ -304,7 +325,7 @@ const VerifySelectionsSection: React.FC = ({ ) : ( <> - {plaintextVoteQuestions.map((voteQuestion) => ( + {sortedPlaintextVoteQuestions.map((voteQuestion) => (