summaryrefslogtreecommitdiff
path: root/rt/share/html/RTx/Statistics/TimeToResolve/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'rt/share/html/RTx/Statistics/TimeToResolve/index.html')
-rwxr-xr-xrt/share/html/RTx/Statistics/TimeToResolve/index.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/rt/share/html/RTx/Statistics/TimeToResolve/index.html b/rt/share/html/RTx/Statistics/TimeToResolve/index.html
new file mode 100755
index 000000000..ad3e23ace
--- /dev/null
+++ b/rt/share/html/RTx/Statistics/TimeToResolve/index.html
@@ -0,0 +1,70 @@
+<& /Elements/Header, Title => 'Time to Resolve in Queue' &>
+<& /RTx/Statistics/Elements/Tabs, Title => 'Time to Resolve, by ticket in Queue:' . $QueueObj->Name() &>
+
+<h3>Description</h3>
+<p>This page displays the same information as the Time to Resolve chart, but in a scattergraph format and only for the previous 7 calendar
+days. It only displays data for tickets which have been resolved. Each division on the Days axis is one day and the granularity of this chart
+is 30 minutes.</p>
+
+<form method="POST">
+
+% my $url = 'Elements/Chart?x_labels=';
+% my $i;
+% $url .= join ",", (map {(int($_/2) == $_/2 && (++$i)%2) ? $_/2 : ""} grep {$counts[$_]} 0..($#counts-1)), "longer";
+% $url .= '&';
+% $url .= "marker_size=1&";
+% $url .= "data1=".(join ",", map { $_ || () } @counts)."&";
+% chop $url;
+<& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &>
+
+<& /RTx/Statistics/Elements/ControlsAsTable/ControlBox,
+ Title => "Change Queue",
+ ShowSingleQueue => 1, Queue=>$Queue,
+&>
+
+</form>
+
+%Statistics::DebugInit($m);
+
+<%ARGS>
+$Queue => undef
+</%ARGS>
+
+<%INIT>
+use RTx::Statistics;
+
+my @days = qw(Sun Mon Tue Wed Thu Fri Sat);
+my $n = 0;
+my @data = ([]);
+my @msgs;
+my @counts;
+
+Statistics::DebugClear();
+Statistics::DebugLog("TimeToResolve/index.html ARGS:\n");
+for my $key (keys %ARGS) {
+ Statistics::DebugLog("ARG{ $key }=" . $ARGS{$key} . "\n");
+}
+
+my $QueueObj = new RT::Queue($session{'CurrentUser'});
+#if (!defined $queue) {
+# $QueueObj->Load($Statistics::TimeToResolveGraphQueue);
+# $queue = $QueueObj->Id();
+#} else {
+ $QueueObj->Load($Queue);
+#}
+
+
+my $tix = new RT::Tickets($session{'CurrentUser'});
+$tix->LimitQueue (VALUE => $Queue) if $Queue;
+$tix->LimitStatus(VALUE => "resolved");
+$tix->UnLimit;
+if ($tix->Count) {
+ while (my $t = $tix->RT::SearchBuilder::Next) { # BLOODY HACK
+ my $when = $t->ResolvedObj->Unix - $t->CreatedObj->Unix;
+ next unless $when > 0; # Doubly bloody hack
+ my $max = (60*60*24*2) / 1800;
+ my $x = int($when / 1800);
+ $counts[$x > $max ? $max : $x]++;
+ }
+}
+</%INIT>