Skip to content

Commit

Permalink
troubleshooting WIP: create params hash if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ikluft committed Sep 7, 2023
1 parent 4973dcb commit 0322105
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/perl/prefvote/lib/PrefVote/Core/Input/CEF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ sub cef_second_pass
foreach my $candidate_name (@candidates) {
$choices{$candidate_name} = $candidate_name;
}
if ( not exists $self->{vote_def}{params}) {
$self->{vote_def}{params} = {};
}
$self->{vote_def}{params}{choices} = \%choices;

# scan ballots for explicit /EMPTY_RANKING/ marker
Expand Down Expand Up @@ -250,6 +253,9 @@ sub set_cef_param
if ( exists $cef2pv{$cef_param_name}) {
$self->{vote_def}{$cef2pv{$cef_param_name}} = $value;
} elsif ( exists $cef2flags{$cef_param_name}) {
if ( not exists $self->{vote_def}{params}) {
$self->{vote_def}{params} = {};
}
$self->{vote_def}{params}{$cef2flags{$cef_param_name}} = $value;
} else {
#carp( __PACKAGE__ . ":unrecognized CEF parameter $cef_param_name" );
Expand Down Expand Up @@ -343,6 +349,9 @@ sub parse

# use default title if not set
if ( not exists $self->{vote_def}{params}{name}) {
if ( not exists $self->{vote_def}{params}) {
$self->{vote_def}{params} = {};
}
$self->{vote_def}{params}{name} = $cef_default_title;
}

Expand Down

0 comments on commit 0322105

Please sign in to comment.