[Bps-public-commit] rt-extension-timetracking branch, auto-time-tracking, updated. 0.21-5-g71088bb

Steve Burr steve at bestpractical.com
Wed May 12 08:47:20 EDT 2021


The branch, auto-time-tracking has been updated
       via  71088bb78a5170573789db6c72289ec4cd591b51 (commit)
      from  7c04dc68dd92239455a3708590ef09896549e03e (commit)

Summary of changes:
 .../Ticket/Elements/ShowBasics/EndOfList                  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 71088bb78a5170573789db6c72289ec4cd591b51
Author: Steven Burr <steve at bestpractical.com>
Date:   Wed May 12 08:46:50 2021 -0400

    Remove ability to change time spent units

diff --git a/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
index 94cdabe..44e9e34 100644
--- a/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
+++ b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
@@ -46,7 +46,10 @@ $today->SetToNow();
           <input name="UpdateTimeWorked" type="text" value="<% $ARGS{UpdateTimeWorked} || '' %>" size="5" class="form-control" />
         </div>
         <div class="col-auto">
+          <!-- uncomment to restore dynamic unit selection
           <& /Elements/SelectTimeUnits, Name => 'UpdateTimeWorked-TimeUnits', Default => $ARGS{'UpdateTimeWorked-TimeUnits'} || 'minutes' &>
+          -->
+          <input type="text" name="UpdateTimeWorked-TimeUnits" disabled="disabled" value="minutes" class="form-control" size="7" />
         </div>
         <div class="col-auto">
           <input type="submit" class="btn btn-primary form-control" value="<% loc('Add') %>">
@@ -62,12 +65,13 @@ var timeTrackerTimer
 
 var rawTimeSpent = function() {
     // raw time worked in seconds, as a float
-    return (Date.now() - timeTrackingStart) / (1000)
+    return (Date.now() - timeTrackingStart) / 1000
 }
 
 var timeSpent = function() {
-    // time worked in minutes, as an int (always round up)
-    return Math.ceil( rawTimeSpent() / 60 )
+    // time worked in minutes, as an int (always round
+    // down to be consistent with the other RT timer)
+    return Math.floor( rawTimeSpent() / 60 )
 }
 
 var parseUrl = function(url) {
@@ -111,10 +115,7 @@ jQuery(document).ready(function() {
     })
 
     var fn = function() {
-        // Time in minutes for submission
-        // Round down to be consistent with RTs ticket timer
-        var tm = Math.floor( timeSpent() / 60 )
-        var tm_show = ToMMSS( timeSpent() )
+        var tm = timeSpent()
 
         var addTimeToLink = function() {
             var el = jQuery(this)

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


More information about the Bps-public-commit mailing list