Skip to content

Drawing lots for candidate nominations (P 15)#3471

Merged
stacktraceghost merged 1 commit into
mainfrom
drawing-lots-candidates
Jun 29, 2026
Merged

Drawing lots for candidate nominations (P 15)#3471
stacktraceghost merged 1 commit into
mainfrom
drawing-lots-candidates

Conversation

@oliver3

@oliver3 oliver3 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What & why

How to test

Unit test test_with_drawing_of_lots_error() has been updated with drawing lots for candidates and asserting the result

Unit test test_preferential_candidate_nomination_scenarios() tests multiple scenarios for candidate nomination (P 15)

Frontend will be implemented in a later issue from Epic #788

Reviewer notes

Main change is in candidate_nomination_per_list() in backend/apportionment/src/candidate_nomination/mod.rs and I suggest starting there.

Two other changes are:

  • Change CandidateNominationInput::total_seats_per_list from a Vec to a HashMap
  • Change CandidateVotesMock to a tuple struct for one-line construction, to improve test readability

I've tried adding the candidates_drawn iterator to the CandidateNominationInput struct instead of passing it as a separate argument, but the generics became even more complex, and also the whole input would then have to become mutable. I decided that that was not making things more clear.

@oliver3 oliver3 self-assigned this Jun 25, 2026
@oliver3 oliver3 requested a review from a team as a code owner June 25, 2026 15:45
@oliver3 oliver3 linked an issue Jun 25, 2026 that may be closed by this pull request
@oliver3 oliver3 added the backend Issues or pull requests that relate to the backend label Jun 25, 2026
@oliver3 oliver3 changed the title Use candidates_drawn iterator for drawing lots for candidate nominations (P 15) Drawing lots for candidate nominations (P 15) Jun 25, 2026
Comment thread backend/apportionment/src/structs.rs
Comment thread backend/apportionment/src/candidate_nomination/mod.rs
@stacktraceghost stacktraceghost added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 84be97c Jun 29, 2026
22 checks passed
@stacktraceghost stacktraceghost deleted the drawing-lots-candidates branch June 29, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Issues or pull requests that relate to the backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend: process drawing lots for candidates results

3 participants