[Bps-public-commit] rt-extension-timetracking branch add-output-time-format-options created. 0.23-2-g4307a24
BPS Git Server
git at git.bestpractical.com
Thu Mar 2 19:59:40 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 4307a24b8481abdac1b9c3d72e7f7f758b905d98 (commit)
- Log -----------------------------------------------------------------
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