[Bps-public-commit] rt-extension-timetracking branch add-output-time-format-options created. 0.23-3-gf4eaccd

BPS Git Server git at git.bestpractical.com
Mon Mar 6 22:17:09 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-timetracking".

The branch, add-output-time-format-options has been created
        at  f4eaccd56d9a04547d671f0075dfb450789dc6c2 (commit)

- Log -----------------------------------------------------------------
commit f4eaccd56d9a04547d671f0075dfb450789dc6c2
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Mon Mar 6 19:14:30 2023 -0300

    Add Time Search Tool usage instructions to POD

diff --git a/lib/RT/Extension/TimeTracking.pm b/lib/RT/Extension/TimeTracking.pm
index e9d7009..2ece2f2 100644
--- a/lib/RT/Extension/TimeTracking.pm
+++ b/lib/RT/Extension/TimeTracking.pm
@@ -180,6 +180,41 @@ You can view other weeks on My Week by selecting any day in the desired week usi
 the date picker at the top of the page. You can also use the Previous and Next
 links to move from week to week.
 
+=head2 Time Search Tool
+
+This extension also adds the "Time Search" page under Tools. This page allows
+you to search for tickets and summarize the time worked on them.
+
+=head3 Ticket Query
+
+You can search using the same criteria as the normal ticket search, but you can
+also filter by tracked time date range.
+
+=head3 Time Worked Display
+
+You can choose between the following output formats for the time worked:
+
+    Exact time, hours and minutes: Display the exact time worked, including
+    minutes in decimal format. For example, 1 hour and 30 minutes would be
+    displayed as 1.5 hours.
+
+    Hours only, rounded up: Display the time worked rounded up to the nearest
+    hour. For example, 1 hour and 30 minutes would be displayed as 2 hours.
+
+    Hours only, rounded to nearest hour: Display the time worked rounded to
+    the nearest hour. For example, 1 hour and 30 minutes would be displayed
+    as 1 hour. 15 minutes would be displayed as 0 hours.
+
+=head3 Include All Children?
+
+If you select this option, the time worked on all child tickets will be
+included in the total time worked for the parent ticket.
+
+=head3 Display Estimated Time
+
+If you select this option, the Estimated Time field will be displayed for
+each ticket.
+
 =head2 Administrative View
 
 TimeTracking adds a right to allow some users to see the My Week page for other

commit 4307a24b8481abdac1b9c3d72e7f7f758b905d98
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Mar 1 16:02:37 2023 -0300

    Add option to specify output time format
    
    User can specify output time format in the TimeSearch tool between
    fractional time, rounded up and rounded to the nearest hour.

diff --git a/html/Tools/TimeSearch.html b/html/Tools/TimeSearch.html
index 869767a..f8a1e89 100644
--- a/html/Tools/TimeSearch.html
+++ b/html/Tools/TimeSearch.html
@@ -19,6 +19,32 @@
       <div class="col-3 label"><&|/l&>End Date</&>:</div>
       <div class="col-9 value"><& /Elements/SelectDate, ShowTime => 0, Name => 'EndDate', Default => $end_date->Date(Format=>'ISO', Timezone => 'user') &></div>
   </div>
+  <div class="form-row">
+      <div class="col-3 label"><&|/l&>Time Worked Display</&>:</div>
+      <div class="col-9 value">
+          <div class="custom-control custom-radio">
+            <input type="radio" name="TimeWorkedDisplay" value="1" class="custom-control-input"
+                    id="TimeWorkedDisplay1"
+                    <% $TimeWorkedDisplay == 1 ? 'checked="checked"' : '' %> />
+            <label for="TimeWorkedDisplay1"
+                class="custom-control-label"><&|/l&>Exact time, hours and minutes</&></label><br>
+          </div>
+          <div class="custom-control custom-radio">
+            <input type="radio" name="TimeWorkedDisplay" value="2" class="custom-control-input"
+                    id="TimeWorkedDisplay2"
+                    <% $TimeWorkedDisplay == 2 ? 'checked="checked"' : '' %> />
+            <label for="TimeWorkedDisplay2"
+                class="custom-control-label"><&|/l&>Hours only, rounded up</&></label><br>
+          </div>
+          <div class="custom-control custom-radio">
+            <input type="radio" name="TimeWorkedDisplay" value="3" class="custom-control-input"
+                    id="TimeWorkedDisplay3"
+                    <% $TimeWorkedDisplay == 3 ? 'checked="checked"' : '' %> />
+            <label for="TimeWorkedDisplay3"
+                class="custom-control-label"><&|/l&>Hours only, rounded to nearest hour</&></label><br>
+          </div>
+      </div>
+  </div>
   <div class="form-row include-children">
       <div class="col-3 label"><&|/l&>Include All Children?</&></div>
       <div class="col-9 value"><& /Widgets/Form/Boolean:InputOnly, Name => 'IncludeChildren', CurrentValue => $IncludeChildren &></div>
@@ -190,7 +216,6 @@ if ( $ARGS{DoSearch} ) {
         next if $txn->FirstCustomFieldValue( 'Worked Date' );    # we handle this in the next part
         $ticket_worked{ $ticket->id } ||= { ticket => $ticket, };
         $ticket_worked{ $ticket->id }{time_worked} += $txn->TimeTaken;
-        $total_time_worked += $txn->TimeTaken;
     }
 
     $txns = RT::Transactions->new( $user );
@@ -238,8 +263,22 @@ if ( $ARGS{DoSearch} ) {
         my $ticket = $txn->Object;
         $ticket_worked{ $ticket->id } ||= { ticket => $ticket, };
         $ticket_worked{ $ticket->id }{time_worked} += $txn->TimeTaken;
-        $total_time_worked += $txn->TimeTaken;
     }
+
+    if ($TimeWorkedDisplay == 2) {
+        # Round up
+        for my $ticket_id (keys %ticket_worked) {
+            $ticket_worked{$ticket_id}{time_worked} =
+                (int(($ticket_worked{$ticket_id}{time_worked} / 60) + 0.9999)*60);
+        }
+    } elsif ($TimeWorkedDisplay == 3) {
+        # Round to nearest hour
+        for my $ticket_id (keys %ticket_worked) {
+            $ticket_worked{$ticket_id}{time_worked} =
+                (int(($ticket_worked{$ticket_id}{time_worked} / 60) + 0.5)*60);
+        }
+    }
+    $total_time_worked = List::Util::sum( map { $ticket_worked{$_}{time_worked} } keys %ticket_worked );
 }
 </%INIT>
 
@@ -248,5 +287,6 @@ $Query => undef
 $StartDate => undef
 $EndDate => undef
 $IncludeChildren => 1
+$TimeWorkedDisplay => 1
 $TimeEstimated => 1
 </%ARGS>

commit 24e264ab3e2434825a322f6e3889d722ba249379
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Mar 1 16:11:59 2023 -0300

    Add option to show estimated time column
    
    Add checkbox to select if estimated time column should be shown or not.

diff --git a/html/Tools/TimeSearch.html b/html/Tools/TimeSearch.html
index 3d14aea..869767a 100644
--- a/html/Tools/TimeSearch.html
+++ b/html/Tools/TimeSearch.html
@@ -23,6 +23,11 @@
       <div class="col-3 label"><&|/l&>Include All Children?</&></div>
       <div class="col-9 value"><& /Widgets/Form/Boolean:InputOnly, Name => 'IncludeChildren', CurrentValue => $IncludeChildren &></div>
   </div>
+  <div class="form-row output-estimated">
+    <div class="col-3 label"><&|/l&>Display Estimated Time?</&></div>
+    <div class="col-9 value"><& /Widgets/Form/Boolean:InputOnly, Name => 'TimeEstimated', CurrentValue => $TimeEstimated &>
+    </div>
+  </div>
   <div class="form-row">
     <div class="col-12">
       <& /Elements/Submit, Name => 'DoSearch', Label => loc("Search") &>
@@ -46,7 +51,9 @@
         <th class="collection-as-table"><% $display_cf %></th>
 % }
         <th class="collection-as-table"><&|/l&>Time Worked</&></th>
+% if ( $TimeEstimated ){
         <th class="collection-as-table"><&|/l&>Time Estimated</&></th>
+% }
     </tr>
 % my $i = 1;
 % for my $ticket_id ( sort { $a <=> $b } keys %ticket_worked ) {
@@ -66,7 +73,9 @@
         <td class="collection-as-table"><% $ticket->FirstCustomFieldValue($display_cf) %></td>
 % }
         <td class="collection-as-table"><& /Ticket/Elements/ShowTime, minutes => $entry->{time_worked} &></td>
+% if ( $TimeEstimated ){
         <td class="collection-as-table"><& /Ticket/Elements/ShowTime, minutes => $ticket->TimeEstimated &></td>
+% }
     </tr>
 % }
 </table>
@@ -239,4 +248,5 @@ $Query => undef
 $StartDate => undef
 $EndDate => undef
 $IncludeChildren => 1
+$TimeEstimated => 1
 </%ARGS>
diff --git a/static/css/time_tracking.css b/static/css/time_tracking.css
index 6627c70..6e3a3c0 100644
--- a/static/css/time_tracking.css
+++ b/static/css/time_tracking.css
@@ -38,6 +38,7 @@ div.time_tracking h2 {
     margin-top: 30px;
 }
 
-div.time_tracking div.include-children div.value {
+div.time_tracking div.include-children div.value,
+div.time_tracking div.output-estimated div.value {
     margin-top: 5px;
 }

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt-extension-timetracking


More information about the Bps-public-commit mailing list