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

Matt Zagrabelny mzagrabe at d.umn.edu
Tue Jan 26 14:39:22 EST 2016


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