Changeset 20 for trunk/lib/Vote/Controller
- Timestamp:
- 03/08/09 15:36:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/Controller/Ballot.pm
r19 r20 64 64 $c->stash->{choices} = { %choices }; 65 65 $c->stash->{sbal} = { map { $_ => 1 } $c->req->param('sbal') }; 66 $c->stash->{fsbal} = [ map {66 $c->stash->{fsbal} = [ grep { $_ } map { 67 67 s/^\s+//; 68 68 s/\s+$//; … … 71 71 } ($c->req->param('fsbal')) ]; 72 72 73 my @torecord = grep { $_ } ( 74 (map { $choices{$_} } $c->req->param('sbal')), 75 @{ $c->stash->{fsbal} } 76 ); 77 78 if (scalar(@torecord) > $vote->vote_info($id)->{choice_count}) { 73 my @sbalval = grep { $_ } map { $choices{$_} } $c->req->param('sbal'); 74 75 if (scalar(@sbalval) + scalar(@{$c->stash->{fsbal} || []}) 76 > $vote->vote_info($id)->{choice_count}) { 79 77 $c->req->param('ballot', ''); 80 78 $c->stash->{vote_error} = 'Seulement ' . … … 84 82 { 85 83 my %uniq; 86 $uniq{lc($_)} foreach(@torecord);87 if (scalar(keys %uniq) != scalar(@ torecord)) {84 $uniq{lc($_)} = 1 foreach(@sbalval, @{$c->stash->{fsbal} || []}); 85 if (scalar(keys %uniq) != scalar(@sbalval) + scalar(@{$c->stash->{fsbal} || []})) { 88 86 $c->req->param('ballot', ''); 89 87 $c->stash->{vote_error} = 'Une valeur est en double'; … … 96 94 $uid, 97 95 $id, 98 [ @torecord ], 96 [ @sbalval ], 97 [ @{ $c->stash->{fsbal} } ], 99 98 $c->req->address, 100 99 ); # TODO trap error
Note: See TracChangeset
for help on using the changeset viewer.