Skip to content

Commit

Permalink
Randomize ballot order when fetching them
Browse files Browse the repository at this point in the history
  • Loading branch information
ApsiV11 committed Dec 6, 2024
1 parent 337fba2 commit 56dd8d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/backend/routes/elections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export const findFinishedElectionWithVotes = async () => {
ballots: {
with: {
votes: true
}
},
orderBy: (_ballotsTable, { sql }) => sql`RANDOM()` // Randomize the order
}
}
})
Expand All @@ -41,7 +42,8 @@ export const getCompletedElectionWithVotes = async (electionId: string) => {
ballots: {
with: {
votes: true
}
},
orderBy: (_ballotsTable, { sql }) => sql`RANDOM()` // Randomize the order
}
}
})
Expand Down

0 comments on commit 56dd8d4

Please sign in to comment.