You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/11/22 00:41:19 UTC

svn commit: r348025 - /spamassassin/trunk/masses/rule-qa/rule-hits-over-time

Author: jm
Date: Mon Nov 21 15:41:13 2005
New Revision: 348025

URL: http://svn.apache.org/viewcvs?rev=348025&view=rev
Log:
fix bug, where nonexistent results are incorrectly listed as '0', as long as one result exists before them

Modified:
    spamassassin/trunk/masses/rule-qa/rule-hits-over-time

Modified: spamassassin/trunk/masses/rule-qa/rule-hits-over-time
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/rule-hits-over-time?rev=348025&r1=348024&r2=348025&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/rule-hits-over-time (original)
+++ spamassassin/trunk/masses/rule-qa/rule-hits-over-time Mon Nov 21 15:41:13 2005
@@ -48,6 +48,7 @@
 use vars qw(
         $opt_rule $opt_size_x $opt_size_y $opt_text $opt_cgi
         $opt_period $opt_as_counts $opt_scale_period
+        $opt_debug
 );
 
 GetOptions(
@@ -59,11 +60,12 @@
         'as_counts',
         'scale_period=i',
         'period=i',
+        'debug'
 ) or usage();
 
 usage() unless $opt_rule;
 
-my $DEBUG_TMPDIR = 0;   # keep the tmpdir around after exiting, for debug
+my $DEBUG_TMPDIR = $opt_debug; # keep the tmpdir around after exiting, for debug
 
 # fix PATHs for sucky Solaris compatibility.
 $ENV{PATH} = "/local/gnuplot-4.0.0/bin:/opt/sfw/bin:".$ENV{PATH};
@@ -226,8 +228,8 @@
       }
 
       if ($scale_to_total_volume) {
-        if ($sy >= 0) {
-          my $frac = $sy / (($sy + $sn) || 0.0001);
+        if ($sy >= 0 && ($sy+$sn) > 0) {
+          my $frac = $sy / ($sy + $sn);
           push @cols, ($frac * 100.0);
         }
         else {
@@ -477,7 +479,9 @@
       open (DATA, ">$tmpdir/avgs$a.$graphname.data") or die;
       if (@{$graph_data}) {
         foreach my $j (0 .. $num_datapoints) {
-          print DATA $times->[$j]," ",join(' ', @{$avgs->[$a]->[$j]}),"\n";
+          print DATA $times->[$j]," ",
+              defined $avgs->[$a]->[$j] ? join ' ', @{$avgs->[$a]->[$j]} : '0',
+              "\n";
         }
       } else {
         # a fake datapoint so gnuplot doesn't puke on us