[Bps-public-commit] rt-extension-timetracking branch, auto-time-tracking, updated. 0.21-3-ga81dee6
Jim Brandt
jbrandt at bestpractical.com
Thu May 6 14:28:25 EDT 2021
The branch, auto-time-tracking has been updated
via a81dee6f93ebdefb33bf7f255284cf0b0dc557f8 (commit)
from b26b398e91fa2be93bfefdcc4341af1c713fde3d (commit)
Summary of changes:
.../Ticket/Display.html/Initial | 9 +++++++++
.../Ticket/Elements/ShowBasics/EndOfList | 23 +++++++++++++++++-----
2 files changed, 27 insertions(+), 5 deletions(-)
create mode 100644 html/Callbacks/RT-Extension-TimeTracking/Ticket/Display.html/Initial
- Log -----------------------------------------------------------------
commit a81dee6f93ebdefb33bf7f255284cf0b0dc557f8
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu May 6 14:27:12 2021 -0400
Show seconds in the display so it's clear the timer is running
The inputs accept only minutes, but with the minute counter,
it wasn't immediately obvious that the timer was running.
diff --git a/html/Callbacks/RT-Extension-TimeTracking/Ticket/Display.html/Initial b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Display.html/Initial
new file mode 100644
index 0000000..3a8e139
--- /dev/null
+++ b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Display.html/Initial
@@ -0,0 +1,9 @@
+<%init>
+# Trim off seconds that may have been added by the auto timer
+if ( $ARGSRef->{'UpdateTimeWorked'} and $ARGSRef->{'UpdateTimeWorked'} =~ /(\d+)\:\d\d$/ ) {
+ $ARGSRef->{'UpdateTimeWorked'} = int($1);
+}
+</%init>
+<%args>
+$ARGSRef
+</%args>
diff --git a/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
index 8ca0739..d4c9364 100644
--- a/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
+++ b/html/Callbacks/RT-Extension-TimeTracking/Ticket/Elements/ShowBasics/EndOfList
@@ -59,9 +59,19 @@ $today->SetToNow();
var timeTrackingStart
var timeTrackerTimer
+var ToMMSS = function (Total) {
+ var Minutes = Math.floor(Total / 60);
+ var Seconds = Total - (Minutes * 60);
+
+ if (Minutes < 10) { Minutes = "0" + Minutes; }
+ if (Seconds < 10) { Seconds = "0" + Seconds; }
+
+ return Minutes + ':' + Seconds;
+}
+
var timeSpent = function() {
- // time worked in minutes
- return Math.ceil( (Date.now() - timeTrackingStart) / (1000 * 60) )
+ // time worked in seconds
+ return Math.ceil( (Date.now() - timeTrackingStart) / 1000 )
}
var parseUrl = function(url) {
@@ -93,7 +103,10 @@ jQuery(document).ready(function() {
})
var fn = function() {
- var tm = timeSpent()
+ // 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 addTimeToLink = function() {
var el = jQuery(this)
@@ -104,7 +117,7 @@ jQuery(document).ready(function() {
}
// uncomment to have time auto-increment visibly on the Display page
- jQuery('input[name="UpdateTimeWorked"]').val(tm)
+ jQuery('input[name="UpdateTimeWorked"]').val(tm_show)
jQuery('select[name="UpdateTimeWorked-TimeUnits"]').val("minutes")
// loop over the actions menu links and append UpdateTimeWorked value
@@ -122,7 +135,7 @@ jQuery(document).ready(function() {
}
// auto-update every 10 seconds
- timeTrackerTimer = setInterval(fn, 10 * 1000)
+ timeTrackerTimer = setInterval(fn, 1 * 1000)
})
</script>
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list