<& /Elements/Header, title => 'Statistics' &>

Number of Tickets Handled in <% $QueueObj->Name %> Per Day

% for my $status (qw(resolved created killed)) { % for my $d (0..$#dates) { % my $x = 1; % } %}
Dates <% $status %> % }
<% $days[(localtime($dates[$d]->Unix))[6]]." ". (localtime($dates[$d]->Unix))[3]%> % for my $status (qw(resolved created killed)) { % my $tix = new RT::Tickets($session{'CurrentUser'}); % if ($status eq "resolved") { % $tix->LimitStatus(VALUE => $status); % $tix->LimitResolved(VALUE => $dates[$d]->ISO, OPERATOR => ">="); % if ($dates[$d+1]) { % $tix->LimitResolved(VALUE => $dates[$d+1]->ISO, OPERATOR => "<="); % } % } elsif ($status eq "created") { % $tix->LimitCreated(VALUE => $dates[$d]->ISO, OPERATOR => ">="); % if ($dates[$d+1]) { % $tix->LimitCreated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<="); % } % } elsif ($status eq "killed") { % $tix->LimitStatus(VALUE => "dead"); % $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR => ">="); % if ($dates[$d+1]) { % $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<="); % } % } % $tix->LimitQueue (VALUE => $queue); <% $tix->Count %> % $data[$x++][$d] = $tix->Count;
See Queue:
<& /Elements/SelectQueue, Name=>"queue", ShowNullOption=>0 &>
See weekends: name="weekends">
Days to see:

% my $url = $RT::WebURL.'/chart?type=lines&x_labels=['; % $url .= join ",", @{ shift @data }; % $url .= ']&'; % for (0..$#data) { % $url .= "data".(1+$_)."=[".(join ",", @{$data[$_]})."]&"; % } % chop $url;
Resolved Created Killed
<%ARGS> $max => 5 $queue => "unix-support" $weekends => 0 <%INIT> my @days = qw(Sun Mon Tue Wed Thu Fri Sat); 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'); $date->SetToMidnight; my $when = $days[(localtime($date->SetToMidnight))[6]]; $n+= 60*60*24; next if !$weekends and ( $when eq "Sat" or $when eq "Sun" ); unshift @dates, $date; unshift @{ $data[0] }, $days[(localtime($date->Unix))[6]]."%20". (localtime($date->Unix))[3]; }