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

Keith Creasy kcreasy at aph.org
Tue Jan 26 15:33:12 EST 2016


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.

-----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


More information about the rt-users mailing list