Showing 1 changed files with 15 additions and 6 deletions
+15 -6
action/synthesis
... ...
@@ -43,7 +43,7 @@ foreach my $category (keys(%{$polls})) {
43 43
         $sth = $dbh->prepare($request);
44 44
         $slots =  $dbh->selectall_hashref($sth, [ qw(poll_id slot_id) ]);
45 45
 
46
-        $request = "select id as vote_id, uniqId, poll_id, choices from $tables{votes} where poll_id = '$poll_id'";
46
+        $request = "select id as vote_id, uniqId, poll_id, choices, name from $tables{votes} where poll_id = '$poll_id'";
47 47
         $sth = $dbh->prepare($request);
48 48
         $votes =  $dbh->selectall_hashref($sth, [ qw(poll_id uniqId) ]);
49 49
 
... ...
@@ -56,10 +56,12 @@ foreach my $category (keys(%{$polls})) {
56 56
             if ($title lt $polls->{$category}->{$poll_id}->{next}) {
57 57
                 $polls->{$category}->{$poll_id}->{next} = $title;
58 58
             }
59
-            foreach my $uniqId (keys(%{$votes->{$poll_id}})) {
60
-                $polls->{$category}->{$poll_id}->{compteur}++;
61
-            }
62 59
         }
60
+        foreach my $uniqId (keys(%{$votes->{$poll_id}})) {
61
+            $polls->{$category}->{$poll_id}->{compteur}++;
62
+            $polls->{$category}->{$poll_id}->{liste} .= $votes->{$poll_id}->{$uniqId}->{name} . ", " if (substr($votes->{$poll_id}->{$uniqId}->{choices},0, 1) eq '2');
63
+        }
64
+        $polls->{$category}->{$poll_id}->{liste} =~ s/,\s*$//;
63 65
     }
64 66
 }
65 67
 $dbh->disconnect();
... ...
@@ -72,11 +74,18 @@ foreach my $category (keys(%{$polls})) {
72 74
     foreach my $poll_id (keys(%{$polls->{$category}})) {
73 75
         my $title    = $polls->{$category}->{$poll_id}->{title};
74 76
         $data .= "<b>" . strftime("[%a %e %b] ", localtime($polls->{$category}->{$poll_id}->{next})). $title . "</b><br>";
75
-        $data .= "($polls->{$category}->{$poll_id}->{compteur} inscrits)<br>" if ($polls->{$category}->{$poll_id}->{compteur} ge 0);
77
+        if ($polls->{$category}->{$poll_id}->{compteur} gt 0) {
78
+            $data .= "<i>$polls->{$category}->{$poll_id}->{compteur} inscrit-e";
79
+            $data .= "-s" if $polls->{$category}->{$poll_id}->{compteur} gt 1;
80
+            $data .= " dont présent-e: $polls->{$category}->{$poll_id}->{liste}" if length($polls->{$category}->{$poll_id}->{liste}) gt 0;
81
+            $data .= "</i><br>";
82
+        }
76 83
         $data .= $polls->{$category}->{$poll_id}->{description} . "<br><br>";
77 84
     }
78 85
 }
79 86
 
80
-$data .= strftime("%c", localtime()) . '</body></html>';
87
+$data .= "<HR><center>" . strftime("%c", localtime()) . '</center></body></html>';
88
+
89
+$data =~ s/\n/<br>/g;
81 90
 
82 91
 print $data;