[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-devel
Subject:    [rt-devel] Time difference between certain transaction types
From:       "rt-devel" <rt-devel () lists ! netways ! de>
Date:       2003-05-30 14:31:25
[Download RAW message or body]

Hi list,

for reporting I am trying to get time differences between certain transaction types, \
e.g. I would like to know the time between "Take" and "stalled" or "resolved". Right \
now, I do the following, but it produces negative results, when a ticket is stalled \
first and taken later. Maybe someone knows a solution that respects the order :-)

# define minutes
my $seconds = 0;
my $minutes = 0;
my $start;
my $end;
		
# Get all transactions of this ticket
my $Transactions = $self->Transactions;
	
# order by created timestamp
$Transactions->OrderBy(FIELD => 'Created', ORDER => 'ASC');
		
# loop through all of them
while (my $Transaction = $Transactions->Next) {
  
  if ($Transaction->Type eq "Take") {
    $start = $Transaction->CreatedObj;
  }
  if ($Transaction->NewValue eq "stalled" || $Transaction->NewValue eq "resolved") {
    $end = $Transaction->CreatedObj;
  }
  if ($start && $end) {
    $seconds += $end->Diff($start);
    $start = undef;
    $end = undef;
  }
}
		
  # Get minutes and round
  $minutes = int($seconds / 60);

Thanks,
Julian

__________________________________________________________
Julian Hein                   NETWAYS GmbH
Managing Director             Deutschherrnstr. 47a
Fon.0911/92885-0              D-90429 Nürnberg
Fax.0911/92885-31                                        
jhein@netways.de              www.netways.de     
_______________________________________________
rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic