summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-13 06:24:27 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-13 06:24:27 +1100
commitf9658404967d5fd39d22980d953dd49c72795da6 (patch)
tree671d735c31828c1130206a8d070ad75acb77ad2e
parent348dc88775fac78f5c1afa30c4f00d6d14dff592 (diff)
Fixed paper transfer and exhausted paper tracking
-rw-r--r--src/election.adb12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/election.adb b/src/election.adb
index 059f9a9..7a77c4c 100644
--- a/src/election.adb
+++ b/src/election.adb
@@ -336,6 +336,8 @@ package body Election is
Working_Transfer := Transfers.First_Element;
Transfers.Delete_First;
+ Exhausted.Paper_Change := Entries.Reference (Working_Transfer.Position).Total_Papers;
+
if Entries.Reference (Working_Transfer.Position).Status = Excluded then
Entries.Reference (Working_Transfer.Position).Vote_Change :=
- Entries.Reference (Working_Transfer.Position).Total_Votes;
@@ -350,6 +352,7 @@ package body Election is
end if;
Entries.Reference (Working_Transfer.Position).Paper_Change :=
- Entries.Reference (Working_Transfer.Position).Total_Papers;
+ Entries.Reference (Working_Transfer.Position).Total_Papers := 0;
for R in Still_Running.Iterate loop
Working_Position := Still_Running.Reference (R).Index;
@@ -370,8 +373,10 @@ package body Election is
Entries.Reference (Working_Position).Vote_Change + Votes_In;
Entries.Reference (Working_Position).Paper_Change :=
Entries.Reference (Working_Position).Paper_Change + Papers_In;
+ Exhausted.Paper_Change := Exhausted.Paper_Change - Papers_In;
elsif Papers_In > 0 then
Fractional.Paper_Change := Fractional.Paper_Change + Papers_In;
+ Exhausted.Paper_Change := Exhausted.Paper_Change - Papers_In;
end if;
end loop;
@@ -383,13 +388,6 @@ package body Election is
Entries.Reference (Working_Position).Paper_Change;
end loop;
- for From_Bundle of Pref_Data.Reference (Working_Transfer.From) loop
- Papers_In := Given_Bundles.Count_Papers (From_Bundle);
- if Papers_In > 0 then
- Exhausted.Paper_Change := Exhausted.Paper_Change + Papers_In;
- end if;
- end loop;
-
Pref_Data.Replace (Working_Transfer.From, Bundle_Containers.Bundle_Vectors.Empty_Vector);
Fractional.Total_Papers := Fractional.Total_Papers + Fractional.Paper_Change;