summaryrefslogtreecommitdiff
path: root/src/preferences.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/preferences.adb')
-rw-r--r--src/preferences.adb30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/preferences.adb b/src/preferences.adb
index 71c521f..7dd6c95 100644
--- a/src/preferences.adb
+++ b/src/preferences.adb
@@ -50,6 +50,8 @@ package body Preferences is
+ -- Looks at the raw ranking list above the line and the Above_Ballot and
+ -- turns it into a list of CandidateIDs in the order they were ranked.
function Extract_Formal
(Above_Input : in Above_Pref_Array;
Formal_Prefs : out Preference_Array)
@@ -81,6 +83,8 @@ package body Preferences is
+ -- Looks at the raw ranking list below the line and the Below_Ballot and
+ -- turns it into a list of CandidateIDs in the order they were ranked.
function Extract_Formal
(Below_Input : in Below_Pref_Array;
Formal_Prefs : out Preference_Array)
@@ -264,31 +268,23 @@ package body Preferences is
begin
This_In := SU.To_Unbounded_String (Input);
- if not Parse_Above_Line (This_In, Above_Line, This_Remaining) then
- return Empty_Array;
- end if;
-
- if not Comma (This_Remaining, This_In) then
- return Empty_Array;
- end if;
-
- if not Parse_Below_Line (This_In, Below_Line, This_Remaining) then
+ if not Parse_Above_Line (This_In, Above_Line, This_Remaining) or else
+ not Comma (This_Remaining, This_In) or else
+ not Parse_Below_Line (This_In, Below_Line, This_Remaining)
+ then
return Empty_Array;
end if;
Optional_Line_Ending (This_Remaining, This_In);
- if SU.Length (This_In) > 0 then
- return Empty_Array;
- end if;
-
- if Extract_Formal (Below_Line, Result) or else
- Extract_Formal (Above_Line, Result)
+ if SU.Length (This_In) > 0 or else
+ (not Extract_Formal (Below_Line, Result) and then
+ not Extract_Formal (Above_Line, Result))
then
- return Result;
- else
return Empty_Array;
end if;
+
+ return Result;
end Parse_Preferences;