[rt-users] Time left... RE: Display time worked in search results in hours only

Jim Brandt jbrandt at bestpractical.com
Mon Feb 1 14:03:57 EST 2016


Hi Keith,

Yes, we read the mail that comes to the various lists and other places 
people post questions about RT. Unfortunately we don't have time to 
reply to all of the questions users have, but the rt-users list has a 
great volunteer community and I see you got some replies.

Looking below, I think you found the right section of the code. I think 
the best approach would be to add some column maps with the formats you 
want. The process to do that is documented here:

https://bestpractical.com/docs/rt/4.2/customizing/search_result_columns.html

Good luck!
Jim

On 2/1/16 1:06 PM, Keith Creasy wrote:
> Well, no definitive response on this. Does anyone from Best Practical even read these?
>
>
> I can probably fix the problem is someone can just point me to where it should bee fixed. Basically I want Time Estimated, TimeWorked, and TimeLeft to always be in hours both for entry and for display in searches, charts, and tickets. Years, months, and days are irrelevant for our purposes. I don't think specific test criteria is necessary, the problem is plain if you just create a search with the three fields in question displayed. The same for charts and TimeWorked. I just created a chart that requested a summary  of time worked and got "3m 5d 4h" which is pretty meaningless, especially since several people have applied tie worked to the tickets.
>
>
> Thanks in advance for any assistance.
>
> Keith
>
> -----Original Message-----
> From: Matt Zagrabelny [mailto:mzagrabe at d.umn.edu]
> Sent: Tuesday, January 26, 2016 3:37 PM
> To: Keith Creasy
> Subject: Re: [rt-users] Time left... RE: Display time worked in search results in hours only
>
> On Tue, Jan 26, 2016 at 2:31 PM, Keith Creasy <kcreasy at aph.org> wrote:
>> That is strange. They are converting somewhere.
>>
>> I wish all these columns would respect the user settings, minutes or hours. If you give time left a value of 100 hours the search displays 4 days which is not all all what we want. Either minutes or hours would work though we prefer hours.
> Perhaps file a bug report with definitive failure test cases.
>
> <rt-bugs at bestpractical.com>
>
> -m
>
>> -----Original Message-----
>> From: Matt Zagrabelny [mailto:mzagrabe at d.umn.edu]
>> Sent: Tuesday, January 26, 2016 2:39 PM
>> To: Keith Creasy
>> Cc: rt-users at lists.bestpractical.com
>> Subject: Re: [rt-users] Time left... RE: Display time worked in search
>> results in hours only
>>
>> On Tue, Jan 26, 2016 at 12:17 PM, Keith Creasy <kcreasy at aph.org> wrote:
>>> OK, I see that I made a mistake in the subject line.
>>>
>>> I mean "Time Left" as in the body and not "Time Worked" as in the subject.
>> It is strange. I put the three fields into the display of a search.
>> Only "Time Left" is displayed in hours, the other two fields (Time
>> Worked and Time Estimated) show up in minutes. Looking at the column
>> map:
>>
>>      TimeWorked => {
>>          attribute => 'TimeWorked',
>>          title     => 'Time Worked', # loc
>>          value     => sub { return $_[0]->TimeWorkedAsString }
>>      },
>>      TimeLeft => {
>>          attribute => 'TimeLeft',
>>          title     => 'Time Left', # loc
>>          value     => sub { return $_[0]->TimeLeftAsString }
>>      },
>>      TimeEstimated => {
>>          attribute => 'TimeEstimated',
>>          title     => 'Time Estimated', # loc
>>          value     => sub { return $_[0]->TimeEstimatedAsString }
>>      },
>>
>> And here's the code for displaying the time:
>>
>> sub _DurationAsString {
>>      my $self = shift;
>>      my $value = shift;
>>      return "" unless $value;
>>      if ($value < 60) {
>>          return $self->loc("[quant,_1,minute,minutes]", $value);
>>      } else {
>>          my $h = sprintf("%.2f", $value / 60 );
>>          return $self->loc("[quant,_1,hour,hours] ([quant,_2,minute,minutes])", $h, $value);
>>      }
>> }
>>
>> Here are the ticket values:
>>
>> Estimated: 16.7 hours (1,000 minutes)
>> Worked: 10 hours (600 minutes)
>> Left: 8.3 hours (500 minutes)
>>
>> And here is what is displayed in the search:
>>
>> 1000
>> 600
>> 8 hours
>>
>> Something seems to be amiss with _DurationAsString.
>>
>> -m
>>
>>> My version is 4.2.7
>>>
>>>
>>> -----Original Message-----
>>> From: Matt Zagrabelny [mailto:mzagrabe at d.umn.edu]
>>> Sent: Tuesday, January 26, 2016 12:47 PM
>>> To: Keith Creasy
>>> Cc: rt-users at lists.bestpractical.com
>>> Subject: Re: [rt-users] Display time worked in search results in
>>> hours only
>>>
>>> Hi Keith,
>>>
>>> On Tue, Jan 26, 2016 at 11:29 AM, Keith Creasy <kcreasy at aph.org> wrote:
>>>> Hi. I’m going to try this but so far I’ve gotten little or no
>>>> response to anything I’ve asked.
>>> What version of RT are you running?
>>>
>>>> It appears that if you put the “Time Left” field in a search result
>>>> it tries to convert to days, which in our case is just confusing as
>>>> we are tracking actual work hours and not calendar time.
>>> Are you talking about a query predicate or the formatting of the displayed results?
>>>
>>> I'm running 4.2 and did a quick test and the displayed "Time Worked"
>>> was in minutes.
>>>
>>> -m
>>>
>>> ---------
>>> RT 4.4 and RTIR Training Sessions
>>> (http://bestpractical.com/services/training.html)
>>> * Hamburg Germany  March 14 & 15, 2016
> ---------
> RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
> * Hamburg Germany  March 14 & 15, 2016




More information about the rt-users mailing list