[rt-users] Reports based on duration between open and update/closed

Jesper Henriksen jesper at catnet.dk
Wed Mar 31 04:30:49 EDT 2010


On Fri, Mar 26, 2010 at 01:10:10PM +0100, Christian Loos wrote:
> Am 24.03.2010 14:43, schrieb Jesper Henriksen:
> > Hey all,
> > 
> > Is there a way to get reports on how much time a ticket has been
> > open? [..] Bear in mind that if the ticket is closed and then
> > re-opened, the duration in which it was closed should not be
> > counted.
>
> you can do this with an callback under
> local/html/Callbacks/MyCallback/Elements/RT__Ticket/ColumnMap/Once
> where you extend the ticket column_map.
> Attached is the callback I use, where I compare created to resolved in days.
> You can then add the new field 'DaysCreatedToResolved' to the ticket
> search result.

> $COLUMN_MAP->{DaysCreatedToResolved} = {
>     title => 'DaysCreatedToResolved',
>     value => sub {
>         my $Created  = $_[0]->CreatedObj->SetToMidnight;
>         my $Resolved = $_[0]->ResolvedObj->SetToMidnight;
>         return '' unless ( $Resolved > 0 );
>         return '< 1' if ( $Resolved == $Created );
>         return ($Resolved-$Created)/60/60/24;
>     }
> }

Thanks. Now, perl isn't my strong point. But if I read that snip of code
correctly, it doesn't take into account that the ticket may have been
closed for a while and then re-opened. The duration in which the ticket
was closed should not be counted in.

-- 
Jesper Henriksen <jesper at catnet.dk>



More information about the rt-users mailing list