Re: [rt-users] find time span between dates

2010-04-19 Thread Christian Loos
Hi Steven,

I have done this to measure the time (in days) between Created and
Resolved by extending the ticket column_map this way:

For 3.6.x place a file under
local/html/Callbacks/MyCallbackname/Elements/RT__Ticket/ColumnMap/ColumnMap

For 3.8.x this would be
local/html/Callbacks/MyCallbackname/Elements/RT__Ticket/ColumnMap/Once


with the following content:
%ARGS
$COLUMN_MAP = {}
/%ARGS
%INIT
$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;
}
}
/%INIT

Use it as a guide for your way ;-)

Chris

Am 16.04.2010 14:11, schrieb Steven Platt:
 Hi,
 
 Is there a way to report the difference between RT dates (Created 
 Started), either in the standard or advanced search?
 
 I’m looking to generate a report to reflect how rapidly requests are
 addressed by our support staff.
 
 Many thanks
 
 Steve
 
 [RT v3.6.2]
 
 Dr Steven Platt
 
 Bioinformatician
 
 Statistics, Modelling and Bioinformatics
 
 Health Protection Agency
 
 Centre for Infections
 
 London
 
 ___www.hpa.org.uk/bioinformatics_ http://www.hpa.org.uk/bioinformatics
 
 
 
 *
 **
 The information contained in the EMail and any attachments is
 confidential and intended solely and for the attention and use of the
 named addressee(s). It may not be disclosed to any other person without
 the express authority of the HPA, or the intended recipient, or both. If
 you are not the intended recipient, you must not disclose, copy,
 distribute or retain this message or any part of it. This footnote also
 confirms that this EMail has been swept for computer viruses, but please
 re-sweep any attachments before opening or saving. HTTP://www.HPA.org.uk
 ** *
 
 
 
 
 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com



Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


[rt-users] find time span between dates

2010-04-16 Thread Steven Platt
Hi,

Is there a way to report the difference between RT dates (Created 
Started), either in the standard or advanced search? 

I'm looking to generate a report to reflect how rapidly requests are
addressed by our support staff.

Many thanks

Steve
[RT v3.6.2]

Dr Steven Platt
Bioinformatician
Statistics, Modelling and Bioinformatics
Health Protection Agency
Centre for Infections
London
www.hpa.org.uk/bioinformatics



-
**
The information contained in the EMail and any attachments is
confidential and intended solely and for the attention and use of
the named addressee(s). It may not be disclosed to any other person
without the express authority of the HPA, or the intended
recipient, or both. If you are not the intended recipient, you must
not disclose, copy, distribute or retain this message or any part
of it. This footnote also confirms that this EMail has been swept
for computer viruses, but please re-sweep any attachments before
opening or saving. HTTP://www.HPA.org.uk
**
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] find time span between dates

2010-04-16 Thread Raed El-Hames

Steven;

As far as I know there is n't ; what I did is create a global custom 
field , and a global scrip that populates its values with condition on 
Status change from new to open, and the action  is user defined 
subtracting the unix time now - the unix created time; then populating 
the field (in seconds).
Our tickets hardly go back to new once are opened , but an if to see if 
the custom field is empty will be a good safe guard.


Obviously this is only useful going forward, for existing tickets you 
will need to write a script (perl/whatever), pull the tickets you need 
and work out
Started - Created then populate the field, its fairly straight forward 
with Perl and the RT api.


Regards;
Roy

Steven Platt wrote:


Hi,

Is there a way to report the difference between RT dates (Created  
Started) , either in the standard or advanced search ?


I ’ m looking to generate a report to reflect how rapidly requests are 
addressed by our support staff.


Many thanks

Steve

[RT v3.6.2]

Dr Steven Platt

Bioinformatician

Statistics, Modelling and Bioinformatics

Health Protection Agency

Centre for Infections

London

www.hpa.org.uk/bioinformatics http://www.hpa.org.uk/bioinformatics

* 
** 
The information contained in the EMail and any attachments is 
confidential and intended solely and for the attention and use of the 
named addressee(s). It may not be disclosed to any other person 
without the express authority of the HPA, or the intended recipient, 
or both. If you are not the intended recipient, you must not disclose, 
copy, distribute or retain this message or any part of it. This 
footnote also confirms that this EMail has been swept for computer 
viruses, but please re-sweep any attachments before opening or saving. 
HTTP://www.HPA.org.uk 
** 
*




Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] find time span between dates

2010-04-16 Thread Gareth Tupper
Hi Roy

If you wouldn't mind, could you share the scrip that you used to accomplish 
this?  I'm just setting up a small RT installation  those metrics seem like 
they would be great to start recording.

Cheers,
Gareth

-Original Message-
From: rt-users-boun...@lists.bestpractical.com 
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Raed El-Hames
Sent: Friday, April 16, 2010 6:02 AM
To: Steven Platt
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] find time span between dates

Steven;

As far as I know there is n't ; what I did is create a global custom 
field , and a global scrip that populates its values with condition on 
Status change from new to open, and the action  is user defined 
subtracting the unix time now - the unix created time; then populating 
the field (in seconds).
Our tickets hardly go back to new once are opened , but an if to see if 
the custom field is empty will be a good safe guard.

Obviously this is only useful going forward, for existing tickets you 
will need to write a script (perl/whatever), pull the tickets you need 
and work out
Started - Created then populate the field, its fairly straight forward 
with Perl and the RT api.

Regards;
Roy

Steven Platt wrote:

 Hi,

 Is there a way to report the difference between RT dates (Created  
 Started) , either in the standard or advanced search ?

 I ' m looking to generate a report to reflect how rapidly requests are 
 addressed by our support staff.

 Many thanks

 Steve

 [RT v3.6.2]

 Dr Steven Platt

 Bioinformatician

 Statistics, Modelling and Bioinformatics

 Health Protection Agency

 Centre for Infections

 London

 www.hpa.org.uk/bioinformatics http://www.hpa.org.uk/bioinformatics

 * 
 ** 
 The information contained in the EMail and any attachments is 
 confidential and intended solely and for the attention and use of the 
 named addressee(s). It may not be disclosed to any other person 
 without the express authority of the HPA, or the intended recipient, 
 or both. If you are not the intended recipient, you must not disclose, 
 copy, distribute or retain this message or any part of it. This 
 footnote also confirms that this EMail has been swept for computer 
 viruses, but please re-sweep any attachments before opening or saving. 
 HTTP://www.HPA.org.uk 
 ** 
 *


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] find time span between dates

2010-04-16 Thread Raed El-Hames

Gareth;

I have n't my actual scrip to hand at the moment but the below should work ;
Create global custom field (field that applies to all queues) and call 
it TimeToUpdate


Create global scrip:
Scrip Condition: On Status Change
Scrip Action: User defined

Custom action preparation code: 
   if ($self-TransactionObj-NewValue eq 'open' and 
$self-TransactionObj-OldValue eq 'new') {

  return 1;
  } else {
  return undef;
  }

Custom action cleanup code:
 my $cf_v = $self-TicketObj-FirstCustomFieldValue('TimeToUpdate');
 if (($cf_v)  ($cf_v != '')) {
  return undef;
  }
  my $now = new RT::Date($RT::SystemUser);
  $now-SetToNow();
  my $createdObj = $self-TicketObj-CreatedObj ;
  my $diff = $now-Diff($createdObj);
  my $cf_obj = RT::CustomField-new(RT::SystemUser);
  $cf_obj-LoadByName(Name= 'TimeToUpdate');
  $cf_obj-AddValueForObject(Object = $self-TicketObj, Content = $diff);
  return 1;
 
 
By the way -Diff will populate the field with number of seconds ; I 
think in Date.pm there is a method
-DiffAsString that you can use instead of -Diff  which gives you human 
readable difference


Regards;
Roy


Gareth Tupper wrote:

Hi Roy

If you wouldn't mind, could you share the scrip that you used to accomplish this?  
I'm just setting up a small RT installation  those metrics seem like they 
would be great to start recording.

Cheers,
Gareth

-Original Message-
From: rt-users-boun...@lists.bestpractical.com 
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Raed El-Hames
Sent: Friday, April 16, 2010 6:02 AM
To: Steven Platt
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] find time span between dates

Steven;

As far as I know there is n't ; what I did is create a global custom 
field , and a global scrip that populates its values with condition on 
Status change from new to open, and the action  is user defined 
subtracting the unix time now - the unix created time; then populating 
the field (in seconds).
Our tickets hardly go back to new once are opened , but an if to see if 
the custom field is empty will be a good safe guard.


Obviously this is only useful going forward, for existing tickets you 
will need to write a script (perl/whatever), pull the tickets you need 
and work out
Started - Created then populate the field, its fairly straight forward 
with Perl and the RT api.


Regards;
Roy

Steven Platt wrote:
  

Hi,

Is there a way to report the difference between RT dates (Created  
Started) , either in the standard or advanced search ?


I ' m looking to generate a report to reflect how rapidly requests are 
addressed by our support staff.


Many thanks

Steve

[RT v3.6.2]

Dr Steven Platt

Bioinformatician

Statistics, Modelling and Bioinformatics

Health Protection Agency

Centre for Infections

London

www.hpa.org.uk/bioinformatics http://www.hpa.org.uk/bioinformatics

* 
** 
The information contained in the EMail and any attachments is 
confidential and intended solely and for the attention and use of the 
named addressee(s). It may not be disclosed to any other person 
without the express authority of the HPA, or the intended recipient, 
or both. If you are not the intended recipient, you must not disclose, 
copy, distribute or retain this message or any part of it. This 
footnote also confirms that this EMail has been swept for computer 
viruses, but please re-sweep any attachments before opening or saving. 
HTTP://www.HPA.org.uk 
** 
*





Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
  


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com