[Bps-public-commit] r17462 - sd/trunk/lib/App/SD/Replica/rt

ruz at bestpractical.com ruz at bestpractical.com
Tue Dec 30 21:09:36 EST 2008


Author: ruz
Date: Tue Dec 30 21:09:36 2008
New Revision: 17462

Modified:
   sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm

Log:
* clean ticket properties twice, in the beginning and at the end

Modified: sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/rt/PullEncoder.pm	Tue Dec 30 21:09:36 2008
@@ -73,6 +73,11 @@
     my $self   = shift;
     my $ticket = shift;
 
+    # undefine empty fields, we'll delete after cleaning
+    $ticket->{$_} = undef for
+        grep defined $ticket->{$_} && $ticket->{$_} eq '',
+        keys %$ticket;
+
     $ticket->{'id'} =~ s/^ticket\///g;
 
     $ticket->{ $self->sync_source->uuid . '-' . lc($_) } = delete $ticket->{$_}
@@ -88,6 +93,12 @@
     $ticket->{$_} =~ s/ minutes$//
         for grep defined $ticket->{$_}, qw(TimeWorked TimeLeft TimeEstimated);
     $ticket->{'Status'} =~ s/^(resolved|rejected)$/closed/;
+
+    # delete undefined and empty fields
+    delete $ticket->{$_} for
+        grep !defined $ticket->{$_} || $ticket->{$_} eq '',
+        keys %$ticket;
+
     return $ticket;
 }
 



More information about the Bps-public-commit mailing list