From b42d2adc9de06d4ccc31874ea86c4ded3152af1d Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 7 Jul 2017 12:28:11 +1000 Subject: Ensured that Exclude_Candidates won't exclude so many that the remaining vacancies can't be filled --- src/election.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/election.adb b/src/election.adb index 7e825b3..ddbdb26 100644 --- a/src/election.adb +++ b/src/election.adb @@ -556,8 +556,8 @@ package body Election is for R in Running.Iterate loop Votes_To_Be_Excluded := Running.Reference (R).Total_Votes; - exit when Number_Excluded > 0 and - Votes_Excluded + Votes_To_Be_Excluded > Applied_Breakpoint; + exit when Integer (Running.Length) - Number_Excluded <= Vacancies + 1 or + (Number_Excluded > 0 and Votes_Excluded + Votes_To_Be_Excluded > Applied_Breakpoint); Working_Position := Running.Reference (R).Index; Working_ID := Entries.Reference (Working_Position).ID; -- cgit