& /Elements/Header, Title => 'RT Statistics: Average Time To Resolution' &>
<& /Statistics/Elements/Tabs, Title => "RT Statistics: Average Time To Resolution" &>
Times for <% $QueueObj->Name || "All Queues" %>
<%perl>
my $url = 'Elements/Chart?x_labels=';
#$url .= join ",", @{ shift @data };
for(0..$max) {
$url .= $data[0][$_] . ",";
}
chop $url;
$url .= '&';
shift @data;
#$url .= 'y_number_format=&';
# does not work if no ticket has been resolved as of today...
# sometimes not all resolved tickets are found )-:
for (0..$#data) {
$url .= "data".(1+$_)."=".(join ",", @{$data[$_]})."&";
}
chop $url;
%perl>
<%ARGS>
$max => $Statistics::TimeToResolveMaxRows
$queue => $Statistics::TimeToResolveQueue
$weekends => $Statistics::TimeToResolveWeekends
$dateformat => $Statistics::TimeToResolveDateFormat
%ARGS>
<%INIT>
use Statistics;
my $n = 0;
my @data = ([]);
my @dates;
my @msgs;
$max--;
my $QueueObj = new RT::Queue($session{'CurrentUser'});
$QueueObj->Load($queue);
until ($#dates == $max) {
my $date = new RT::Date($session{CurrentUser});
$date->Set(Value=>time - $n, Format => 'unix');
Statistics::RTDateSetToLocalMidnight($date);
$n+= 60*60*24;
next if !$weekends and Statistics::RTDateIsWeekend($date);
unshift @dates, $date;
unshift @{ $data[0] }, Statistics::FormatDate($Statistics::TimeToResolveLabelDateFormat, $date);
}
%INIT>