Skip to content

Commit

Permalink
Use optimized helpers in libs/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
arsalansufi committed Sep 13, 2023
1 parent a668787 commit 84480ad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions apps/admin/backend/src/cast_vote_records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
BallotPageLayoutSchema,
CVR,
ElectionDefinition,
getBallotStyle,
getContests,
getPrecinctById,
safeParseJson,
} from '@votingworks/types';
import {
BooleanEnvironmentVariableName,
castVoteRecordHasValidContestReferences,
convertCastVoteRecordVotesToTabulationVotes,
getBallotStyleById,
getPrecinctById,
isFeatureFlagEnabled,
} from '@votingworks/utils';

Expand Down Expand Up @@ -54,18 +54,18 @@ function validateCastVoteRecordAgainstElectionDefinition(
return wrapError({ subType: 'election-mismatch' });
}

const precinct = getPrecinctById({
election,
precinctId: castVoteRecord.BallotStyleUnitId,
});
const precinct = getPrecinctById(
electionDefinition,
castVoteRecord.BallotStyleUnitId
);
if (!precinct) {
return wrapError({ subType: 'precinct-not-found' });
}

const ballotStyle = getBallotStyle({
ballotStyleId: castVoteRecord.BallotStyleId,
election,
});
const ballotStyle = getBallotStyleById(
electionDefinition,
castVoteRecord.BallotStyleId
);
if (!ballotStyle) {
return wrapError({ subType: 'ballot-style-not-found' });
}
Expand Down

0 comments on commit 84480ad

Please sign in to comment.