[freeside-commits] freeside/rt/html/Reports/Activity ActivityDetail.html, NONE, 1.1 ActivitySummary.html, NONE, 1.1 ResolutionComments.html, NONE, 1.1 ResolutionStatistics.html, NONE, 1.1 index.html, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Wed Jun 20 15:28:30 PDT 2007
- Previous message: [freeside-commits] freeside/rt/html/Callbacks/RT-WebCronTool/Elements/Tabs Default, NONE, 1.1
- Next message: [freeside-commits] freeside/rt/html/Reports/Activity/Elements LimitReport, NONE, 1.1 MiniPlot, NONE, 1.1 PrintFooter, NONE, 1.1 PrintHeader, NONE, 1.1 ScreenFooter, NONE, 1.1 ScreenHeader, NONE, 1.1 Tabs, NONE, 1.1 Wrapper, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/rt/html/Reports/Activity
In directory wavetail:/tmp/cvs-serv10214/rt/html/Reports/Activity
Added Files:
ActivityDetail.html ActivitySummary.html
ResolutionComments.html ResolutionStatistics.html index.html
Log Message:
integrate RTx::Statistics package, part of merging spiritone RT changes (#1661)
--- NEW FILE: ActivityDetail.html ---
<&|Elements/Wrapper, %ARGS, title => loc("Activity detail"),
path => "Reports/Activity/ActivityDetail.html",
&>
<& Elements/MiniPlot, data => \%counts &>
<table style="width: 100%">
<tr class="titlerow">
<th>Queue</th><th>Activity</th><th>Date</th><th>Time</th><th>Ticket #</th><th>User</th><th>Short description</th>
</tr>
% for my $item (@items) {
<tr>
<td><% $item->{queue} %></td>
<td><% $item->{status} %></td>
<td><% $item->{date} %></td>
<td><% $item->{time} %></td>
<td><% $item->{id} %></td>
<td><% $item->{actor} %></td>
<td><% $item->{notes} %></td>
</tr>
% }
</table>
</&>
<%args>
$query => 'id > 0'
$start => "2005/01/01"
$end => "2006/01/01"
</%args>
<%init>
my $summary_tickets = RT::Tickets->new($session{'CurrentUser'});
$summary_tickets->FromSQL($query . " AND ( Updated >= '$start' AND Updated <= '$end')");
my %counts;
while (my $ticket = $summary_tickets->Next) {
my $txns = $ticket->Transactions;
$txns->Limit(FIELD => 'Created', OPERATOR => '>=', VALUE => $start);
$txns->Limit(FIELD => 'Created', OPERATOR => '<=', VALUE => $end);
# I think they really don't just want status changes
$txns->Limit(FIELD => 'Type', VALUE => 'Status', ENTRYAGGREGATOR => 'OR');
$txns->Limit(FIELD => 'Type', VALUE => 'Create');
while (my $txn = $txns->Next){
my $date = substr($txn->Created, 0, 10);
# we don't have data on the status of a new ticket, default to 'new'
$counts{$date}{$txn->NewValue || 'new'}++;
}
}
my $tickets = RT::Tickets->new($session{'CurrentUser'});
$tickets->FromSQL($query);
my @items;
while (my $ticket = $tickets->Next) {
my $txns = $ticket->Transactions;
$txns->Limit(FIELD => 'Created', OPERATOR => '>=', VALUE => $start);
$txns->Limit(FIELD => 'Created', OPERATOR => '<=', VALUE => $end);
# I think they really don't just want status changes
$txns->Limit(FIELD => 'Type', VALUE => 'Status', ENTRYAGGREGATOR => 'OR');
$txns->Limit(FIELD => 'Type', VALUE => 'Create');
while (my $txn = $txns->Next) {
push @items, { queue => $txn->TicketObj->QueueObj->Name,
id => $txn->TicketObj->id,
date => (split ' ', $txn->CreatedObj->ISO)[0],
time => (split ' ', $txn->CreatedObj->ISO)[1],
status => $txn->NewValue || 'new',
actor => $txn->CreatorObj->Name,
notes => ($txn->Content ne 'This transaction appears to have no content' ? substr($txn->Content, 0, 60) : $txn->BriefDescription)
};
}
}
@items = sort {
$a->{queue} cmp $b->{'queue'}
|| $a->{'status'} cmp $b->{'status'}
|| $a->{'id'} <=> $b->{'id'}
|| $a->{'actor'} cmp $b->{'actor'}
|| $a->{'notes'} <=> $b->{'notes'}
} @items;
</%init>
--- NEW FILE: ActivitySummary.html ---
<&|Elements/Wrapper, %ARGS, title => loc("Activity summary"),
path => "Reports/Activity/ActivitySummary.html",
&>
<& Elements/MiniPlot, data => \%queues &>
<table style="width: 100%">
<tr class="titlerow">
<th>Queue</th>
% for my $status (sort keys %status) {
<th><% $status %></th>
% }
<th>Total</th>
</tr>
% for my $queue (sort keys %queues) {
<th class="label"><% $queue %></th>
% for my $status (sort keys %status) {
<td><% $queues{$queue}{$status} || 0 %>
% }
<td><% $total{$queue} %></td>
</tr>
% }
<tr class="grandtotal">
<th class="label" >Grand Total</th>
% for my $status (sort keys %status) {
<td><% $status{$status} %></td>
% }
<td><% $total %></td>
</table>
</&>
<%args>
$query => 'id > 0'
$start => "2005/01/01"
$end => "2006/01/01"
</%args>
<%init>
my $tickets = RT::Tickets->new($session{'CurrentUser'});
$tickets->FromSQL($query . " AND ( Updated >= '$start' AND Updated <= '$end')");
my %queues;
my %status;
my %total;
my $total;
while (my $ticket = $tickets->Next) {
my $txns = $ticket->Transactions;
$txns->Limit(FIELD => 'Created', OPERATOR => '>=', VALUE => $start);
$txns->Limit(FIELD => 'Created', OPERATOR => '<=', VALUE => $end);
$txns->Limit(FIELD => 'Type', VALUE => 'Status', ENTRYAGGREGATOR => 'OR');
$txns->Limit(FIELD => 'Type', VALUE => 'Create');
while (my $txn = $txns->Next) {
$queues{$txn->TicketObj->QueueObj->Name}{$txn->NewValue || 'new'}++;
$status{$txn->NewValue || 'new'}++;
$total{$txn->TicketObj->QueueObj->Name}++;
$total++;
}
}
</%init>
--- NEW FILE: index.html ---
<&| Elements/Wrapper, %ARGS, title => loc("Activity reports"), show_print_link => 0 &>
</&>
<%args>
$type => undef
$start => undef
$end => undef
$query => "Status = 'resolved'"
</%args>
<%init>
unless ($start) {
my $then = RT::Date->new($session{'CurrentUser'});
$then->Set(Format => 'Unix', Value => time - (86400*7));
$ARGS{start} = substr($then->ISO,0,10);
}
unless ($end) {
my $now = RT::Date->new($session{'CurrentUser'});
$now->SetToNow();
$ARGS{end} = substr($now->ISO,0,10);
}
if ($type) {
$m->redirect($type . ".html?" . $m->comp('/Elements/QueryString', query => $query, start => $start, end => $end));
}
</%init>
--- NEW FILE: ResolutionStatistics.html ---
<&|Elements/Wrapper, %ARGS, title => loc("Resolution statistics"),
path => "Reports/Activity/ResolutionStatistics.html",
&>
<& Elements/MiniPlot,
data => \%plot,
major => ['Date range','Last 30 days','Last 60 days','Last 90 days','Ever'],
minor => [(sort keys %queues), "Average"]
&>
<table style="width: 100%">
<tr>
<td></td><th colspan="4">Number of tickets closed / Average resolution time per ticket</th>
</tr>
<tr class="titlerow">
<th>Queue</th>
<th>Date range</th>
<th>Last 30 days</th>
<th>Last 60 days</th>
<th>Last 90 days</th>
<th>Ever</th>
</tr>
% for my $queue (sort keys %queues) {
<tr>
<th><% $queue %></th>
% for my $period ('Date range','Last 30 days','Last 60 days','Last 90 days','Ever') {
<td><% scalar @{$closed{$period}{$queue}} %> / <% $average_resolve_times{$period}{$queue} %></td>
% }
</tr>
% }
<tr class="grandtotal">
<th>Ticket average</th>
% for my $period ('Date range','Last 30 days','Last 60 days','Last 90 days','Ever') {
<td><% $average_resolve_times{$period}{_all_count} %> / <% $average_resolve_times{$period}{_all} %></td>
% }
</tr>
</table>
</&>
<%args>
$query => 'id > 0'
$start => "2005/01/01"
$end => "2006/01/01"
</%args>
<%init>
my $in_30_days = RT::Date->new($session{'CurrentUser'});
$in_30_days->Set(Format => 'Unix', Value => ( time - (86400*30)));
my $in_60_days = RT::Date->new($session{'CurrentUser'});
$in_60_days->Set(Format => 'Unix', Value => ( time - (86400*60)));
my $in_90_days = RT::Date->new($session{'CurrentUser'});
$in_90_days->Set(Format => 'Unix', Value => ( time - (86400*90)));
my %queries;
$queries{'Date range'} = "(Resolved >= '$start' AND Resolved <= '$end')";
$queries{'Last 30 days'} = "(Resolved >= '".$in_30_days->ISO."')";
$queries{'Last 60 days'} = "(Resolved >= '".$in_60_days->ISO."')";
$queries{'Last 90 days'} = "(Resolved >= '".$in_90_days->ISO."')";
$queries{'Ever'} = "(Status = 'resolved' OR Status = 'rejected')";
my %closed;
my %queues;
foreach my $period (keys %queries) {
my $tix = RT::Tickets->new($session{'CurrentUser'});
$tix->FromSQL($query . " AND " .$queries{$period});
while (my $ticket = $tix->Next) {
push @{ $closed{$period}{$ticket->QueueObj->Name}}, $ticket;
$queues{$ticket->QueueObj->Name}++;
}
}
my %restimes;
my %average_resolve_times;
my %plot;
use Time::Duration;
foreach my $period ( keys %closed ) {
foreach my $queue ( keys %{$closed{$period}} ) {
foreach my $ticket (@{$closed{$period}{$queue}} ) {
push @{$restimes{$period}{$queue}}, ( $ticket->ResolvedObj->Unix - $ticket->CreatedObj->Unix);
}
my $total_time = 0;
$total_time+= $_ for @{$restimes{$period}{$queue}};
$average_resolve_times{$period}{'_all_time'} += $total_time;
$average_resolve_times{$period}{'_all_count'} += @{$restimes{$period}{$queue}};
$plot{$period}{$queue} = $total_time / @{$restimes{$period}{$queue}};
$average_resolve_times{$period}{$queue} = Time::Duration::concise(Time::Duration::duration($plot{$period}{$queue}));
}
$plot{$period}{Average} = $average_resolve_times{$period}{'_all_time'} / $average_resolve_times{$period}{'_all_count'};
$average_resolve_times{$period}{'_all'} = Time::Duration::concise(Time::Duration::duration($plot{$period}{Average}));
}
</%init>
--- NEW FILE: ResolutionComments.html ---
<&|Elements/Wrapper, %ARGS, title => loc("Resolution Comments"),
path => "Reports/Activity/ResolutionComments.html",
&>
<table style="width: 100%">
<tr>
<th>Queue</th><th>Ticket #</th><th>Created</th><th>Resolved</th><th>Time to resolve</th>
</tr>
<tr>
<th colspan="5">Resolution comments</th>
</tr>
% for my $item (@items) {
<tr class="titlerow">
<td><% $item->{queue} %></td>
<td><% $item->{id} %></td>
<td><% $item->{created} %></td>
<td><% $item->{resolved} %></td>
<td><% $item->{duration} %></td>
</tr>
<tr>
<td colspan="5"><% $item->{whiteboard} %></td>
</tr>
% }
</table>
</&>
<%args>
$query => 'id > 0'
$start => "2005/01/01"
$end => "2006/01/01"
</%args>
<%init>
use Time::Duration;
my $summary_tickets = RT::Tickets->new( $session{'CurrentUser'} );
$summary_tickets->FromSQL(
$query . " AND (Status = 'resolved') AND ( Updated >= '$start' AND Updated <= '$end')" );
my @items;
while ( my $ticket = $summary_tickets->Next ) {
push @items, {
queue => $ticket->QueueObj->Name,
id => $ticket->id,
created => $ticket->CreatedObj->AsString,
resolved => $ticket->ResolvedObj->AsString,
duration => Time::Duration::concise(
Time::Duration::duration(
$ticket->ResolvedObj->Unix - $ticket->CreatedObj->Unix
)
),
whiteboard => $ticket->FirstCustomFieldValue('Whiteboard')
};
}
@items = sort { $a->{queue} cmp $b->{queue} || $a->{id} <=> $b->{id} } @items;
</%init>
- Previous message: [freeside-commits] freeside/rt/html/Callbacks/RT-WebCronTool/Elements/Tabs Default, NONE, 1.1
- Next message: [freeside-commits] freeside/rt/html/Reports/Activity/Elements LimitReport, NONE, 1.1 MiniPlot, NONE, 1.1 PrintFooter, NONE, 1.1 PrintHeader, NONE, 1.1 ScreenFooter, NONE, 1.1 ScreenHeader, NONE, 1.1 Tabs, NONE, 1.1 Wrapper, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list