% foreach my $question_data (@{$vote_data->{questions}}) {
% if ($question_data->{amount}) {
% my $question_name = $question_data->{question};
% my $qimg_src;
% if ( $question_name =~ /<%\s*\w+_(\d+)\s*%>/i ) {
% my $index = $1;
% if ( ref $pictures && exists $pictures->{"image_$index"} ) {
% my $img = $pictures->{"image_$index"};
% my $mini = $pictures->{"image_$index"}{mini};
% $qimg_src = '';
% }
% $question_name =~ s/<%\s*\w+_(\d+)\s*%>/$qimg_src/i;
% }
<% $question_name %>
% my $total=0;
% my $max_value=1;
% my $total_procent=0;
% map { $total += $_->{votes}; $max_value = $_->{votes} if ($max_value<$_->{votes}); } @{$question_data->{choices}};
% next unless $total;
% my $delta;
% if ( $question_data->{range} ) {
% map {$_->{procent}=int(1000*$_->{votes}/$question_data->{range})/10; $total_procent+=$_->{procent};} @{$question_data->{choices}};
% } else {
% map {$_->{procent}=int(1000*$_->{votes}/$total)/10; $total_procent+=$_->{procent};} @{$question_data->{choices}};
% my $delta = 100-$total_procent;
% }
% my $COLORS=$m->comp('/subs/'.$prj.'/get_colors_green.msn', split=>scalar(@{$question_data->{choices}}));
% my $first=1;
% foreach my $answer_data (sort {$b->{votes} <=> $a->{votes}} @{$question_data->{choices}}) {
% my $color=pop @$COLORS;
% my $procent=$answer_data->{procent};
% if ($first) {
% $first=0;
% $procent+=$delta;
% }
% my $choice_name = $answer_data->{choice};
% my $img_src;
% if ( $choice_name =~ /<%\s*\w+_(\d+)\s*%>/i ) {
% my $index = $1;
% if ( ref $pictures && exists $pictures->{"image_$index"} ) {
% my $img = $pictures->{"image_$index"};
% my $mini = $pictures->{"image_$index"}{mini};
% $img_src = '';
% }
% $choice_name =~ s/<%\s*\w+_(\d+)\s*%>//i;
% }
% my $width;
% if ( $question_data->{range} ) {
% $width=int($answer_data->{procent}) || 1;
% } else {
% $width=int(100*$answer_data->{votes}/$max_value) || 1;
% }
| <% $img_src %> <% $choice_name %> | |
<% sprintf("%.1f",$procent) %>% |
|
% }
% }
% }
% if ($vote_data->{total}) {
Всего проголосовало: <% $vote_data->{total} %>
% }
%
|