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

List:       rt-commit
Subject:    [Rt-commit] rt branch, 4.2/time-worked-txn-display, created. rt-4.1.6-387-gac33d28
From:       trs () bestpractical ! com (Thomas Sibley)
Date:       2013-03-29 22:50:56
Message-ID: 20130329225056.597EF2418001 () booth ! bestpractical ! com
[Download RAW message or body]

The branch, 4.2/time-worked-txn-display has been created
        at  ac33d28fc9de11a27cf845e47b97cbed623677b6 (commit)

- Log -----------------------------------------------------------------
commit ac33d28fc9de11a27cf845e47b97cbed623677b6
Author: Thomas Sibley <trs@bestpractical.com>
Date:   Fri Mar 29 15:48:55 2013 -0700

    Calculate the duration of time worked for history display
    
    Showing a useful duration is easier to quickly read and understand than
    showing the before and after value in minutes.  Why subtract when the
    computer can!

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 13635ec..829ef27 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -997,6 +997,20 @@ sub _FormatUser {
                     ($self->OldValue? "'".$self->OldValue ."'" : $self->loc("(no \
value)")) , "'". $self->NewValue."'" );  }
     },
+    "Set-TimeWorked" => sub {
+        my $self = shift;
+        my $old  = $self->OldValue || 0;
+        my $new  = $self->NewValue || 0;
+        my $duration = $new - $old;
+        if ($duration < 0) {
+            return ("Adjusted time worked by [quant,_1,minute,minutes]", $duration);
+        }
+        elsif ($duration < 60) {
+            return ("Worked [quant,_1,minute,minutes]", $duration);
+        } else {
+            return ("Worked [quant,_1,hour,hours] ([numf,_2] minutes)", \
sprintf("%.1f", $duration / 60), $duration); +        }
+    },
     PurgeTransaction => sub {
         my $self = shift;
         return ("Transaction [_1] purged", $self->Data);    #loc

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit


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

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