kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-11-09 03:31 am

[dw-free] Polls don't render '0' answers

[commit: http://hg.dwscoalition.org/dw-free/rev/efb303765aaa]

http://bugs.dwscoalition.org/show_bug.cgi?id=3213

Check for definition of itid variable, not true value.

Patch by [personal profile] yvi.

Files modified:
  • cgi-bin/LJ/Poll.pm
--------------------------------------------------------------------------------
diff -r 447ebe49b766 -r efb303765aaa cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Mon Nov 08 20:35:32 2010 +0800
+++ b/cgi-bin/LJ/Poll.pm	Mon Nov 08 21:31:44 2010 -0600
@@ -1134,7 +1134,7 @@ sub render {
                 }
 
                 # displaying results
-                my $count = $itid ? $itvotes{$itid} || 0 : 0;
+                my $count = ( defined $itid ) ? $itvotes{$itid} || 0 : 0;
                 my $percent = sprintf("%.1f", (100 * $count / ($usersvoted||1)));
                 my $width = 20+int(($count/$maxitvotes)*380);
 
--------------------------------------------------------------------------------