RTx::Statistics V1.7 Fixes

Hi Everyone,

Las Friday, I sent out a patch to RTx::Statis V1.7. After I sent out the
patch, I found another errors that was giving incorrect results. So,
below are the two patches I made to the software. FYI, the second patch
combines a previous patch submitted by another contributor to this list.

Take care!

Nick

/opt/rt3/share/html/RTx/Statistics/CallsMultiQueues/index.html:

57c57

< % elsif ($status eq “created”) {

% elsif ($status eq “new”) {

76a77,90

% elsif ($status eq “open”) {

% $tix->LimitStatus(VALUE => $status);

% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR =>
">=");

% if ($dates[$d+1]) {

% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR
=> “<=”);

% }

% }

% elsif ($status eq “rejected”) {

% $tix->LimitStatus(VALUE => $status);

% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR =>
">=");

% if ($dates[$d+1]) {

% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR
=> “<=”);

% }

% }

95c109

< % for (qw(resolved created deleted stalled)) {

% for (qw(resolved new deleted stalled rejected open)) {

/opt/rt3/share/html/RTx/Statistics/DayOfWeek/index.html:

35c35

< % $values{Statistics_Created_Count} = $counts[$d]{created};

% $values{Statistics_Created_Count} = $counts[$d]{new};

42c42

< % $values {Statistics_Created_Count} = $Totals{created};

% $values {Statistics_Created_Count} = $Totals{new};

62c62

< my @things = qw(created resolved deleted);

my @things = qw(new resolved deleted);

107c107

< created => 0

new => 0

140c140

< $counts[$day]{created} = 0;

    $counts[$day]{new} = 0;

146,153d145

< } else {

< if($t->Status eq “deleted”) {

< $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{deleted}++;

< $Totals{deleted}++;

< } else {

< $counts[(localtime($t->CreatedObj->Unix))[6]]{created}++;

< $Totals{created}++;

< }

155c147,153

< }

Nick’s changes from this email will be in 0.1.8, can’t promise when that
will be available, but might be today or tomorrow…

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.comFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Nick
Metrowsky
Sent: Tuesday, January 03, 2006 12:32 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] RTx::Statistics V1.7 Fixes

Hi Everyone,

Las Friday, I sent out a patch to RTx::Statis V1.7. After I sent out the
patch, I found another errors that was giving incorrect results. So,
below are the two patches I made to the software. FYI, the second patch
combines a previous patch submitted by another contributor to this list.

Take care!

Nick

/opt/rt3/share/html/RTx/Statistics/CallsMultiQueues/index.html:

57c57

< % elsif ($status eq “created”) {

% elsif ($status eq “new”) {

76a77,90

% elsif ($status eq “open”) {

% $tix->LimitStatus(VALUE => $status);

% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR =>
">=");

% if ($dates[$d+1]) {

% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR
=> “<=”);

% }

% }

% elsif ($status eq “rejected”) {

% $tix->LimitStatus(VALUE => $status);

% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR =>
">=");

% if ($dates[$d+1]) {

% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR
=> “<=”);

% }

% }

95c109

< % for (qw(resolved created deleted stalled)) {

% for (qw(resolved new deleted stalled rejected open)) {

/opt/rt3/share/html/RTx/Statistics/DayOfWeek/index.html:

35c35

< % $values{Statistics_Created_Count} = $counts[$d]{created};

% $values{Statistics_Created_Count} = $counts[$d]{new};

42c42

< % $values {Statistics_Created_Count} = $Totals{created};

% $values {Statistics_Created_Count} = $Totals{new};

62c62

< my @things = qw(created resolved deleted);

my @things = qw(new resolved deleted);

107c107

< created => 0

new => 0

140c140

< $counts[$day]{created} = 0;

    $counts[$day]{new} = 0;

146,153d145

< } else {

< if($t->Status eq “deleted”) {

< $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{deleted}++;

< $Totals{deleted}++;

< } else {

< $counts[(localtime($t->CreatedObj->Unix))[6]]{created}++;

< $Totals{created}++;

< }

155c147,153

< }

 if($t->Status eq "deleted") {
   $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{deleted}++;
   $Totals{deleted}++;
 }
 $counts[(localtime($t->CreatedObj->Unix))[6]]{new}++;
 $Totals{new}++;
 }

I’ve also noticed that the graphs randomly appear. It looks to me that sometimes the graphs actually DO draw, but then subsequently disappear on the individual Statistics pages. Clicking “Download Chart as Image…” may bring them back to the display pages on refresh/update. I’m also seeing some cases where clicking on “Download Chart as Image…” does nothing. If i go back to RT’s “Home Page”, then back to RTx-Statistics it will start working again (randomly as before). This is after restarting Apache, too.

FYI for others who have lots of long named queues…

Another change i’ve made is to …/share/html/RTx/Statistics/OpenStalled/Elements/Chart

Since this bar Chart can accomodate an “All Queues” option, and i’ve got about 30 queues, some containing upto 32 characters in their name, the default horizontal orientation of the X-Axis labels turns into a major smear.

Adding

x_labels_vertical => 1,

to the $graph->set( … ); call fixes that. Of course, when you just have one queue displayed it looks a bit wierd.

I’m also thinking that perhaps these graphs ought to have Titles on them. Because, if you’re gonna click the “Download Chart as Image” option, there should be some standalone context to the image file. I think something like:

$graph->set(...,
    title => 'RT:' . $RT::rtname . ' New, Open and Stalled Tickets per Queue',
    ...);

makes sense. (just my two cents)

BTW, I’ve changed …/lib/RTx/Statistics.pm to make my graphs bigger to accomodate this better.

Width and Height of all graphics

$GraphWidth=800;
$GraphHeight=600;

–stephen
Stephen Dowdy - Systems Administrator - NCAR/RAL
303.497.2869 - sdowdy@ucar.edu - http://www.ral.ucar.edu/~sdowdy/

Stephen,
First off, I looked at including your changes in the 0.1.8
version, but I’m not sure how to make them work in the general case
without making the graph bigger than it already is (which is probably
too big for people with small screens).
But, I was curious about the randomly appearing graphs, first
off, I assume that you’re using 0.1.7, not 0.1.6. What versions of
libgd, GD and GD::Graph are you running?

Kelly F. Hickel
Senior Software Architect
MQSoftware, Inc
952.345.8677
kfh@mqsoftware.com

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-
bounces@lists.bestpractical.com] On Behalf Of Stephen Dowdy
Sent: Tuesday, January 03, 2006 1:57 PM
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] RTx::Statistics V1.7 Fixes

I’ve also noticed that the graphs randomly appear. It looks to me
that
sometimes the graphs actually DO draw, but then subsequently disappear
on
the individual Statistics pages. Clicking "Download Chart as
Image…"
may bring them back to the display pages on refresh/update. I’m
also
seeing some cases where clicking on “Download Chart as Image…” does
nothing. If i go back to RT’s “Home Page”, then back to
RTx-Statistics
it will start working again (randomly as before). This is after
restarting Apache, too.

FYI for others who have lots of long named queues…

Another change i’ve made is to
…/share/html/RTx/Statistics/OpenStalled/Elements/Chart

Since this bar Chart can accomodate an “All Queues” option, and i’ve
got
about 30 queues, some containing upto 32 characters in their name, the
default horizontal orientation of the X-Axis labels turns into a major
smear.

Adding

x_labels_vertical => 1,

to the $graph->set( … ); call fixes that. Of course, when you just
have one queue displayed it looks a bit wierd.

I’m also thinking that perhaps these graphs ought to have Titles on
them.
Because, if you’re gonna click the “Download Chart as Image” option,
there
should be some standalone context to the image file. I think
something
like:

$graph->set(...,
    title => 'RT:' . $RT::rtname . ' New, Open and Stalled Tickets

per

Queue’,
…);

makes sense. (just my two cents)

BTW, I’ve changed …/lib/RTx/Statistics.pm to make my graphs bigger
to