[rt-devel] Re: My first code contribution : approvals

Jesse Vincent jesse at bestpractical.com
Sun Mar 23 16:42:52 EST 2003


This won't make it into 3.0.0, but I can see a patch like it going in
later in the 3.0.x series:

>>    sub HREF {
>>        my $self = shift;
>>   +    my $ticket;
>>        if ($self->IsLocal) {
>>   -        return ( $RT::WebURL .  "Ticket/Display.html?id=".$self->Object->Id);
>>   +        $ticket = RT::Ticket->new($self->CurrentUser);
>>   +        $ticket->Load($self->Object->Id); 

I believe all that can be replaced with 

	my $ticket = $self->Object


>>   +        if ($ticket->Type =~ /pproval/) {

	      if ($ticket->Type =~ /^approval$/i) { 

	is the case-insensitive version of all that.


>>   +            return ( $RT::WebURL .  "Approvals/Display.html?id=".$self->Object->Id);
>>   +        }
>>   +        else {
>>   +            return ( $RT::WebURL .  "Ticket/Display.html?id=".$self->Object->Id);
>>   +        }
>>        }  
>>   

> I suspect some performance issues : I feel I access the database to load
> tickets when they had already been loaded earlier in the process of
> converting Ids to urls. If this is the case, I am wasting resources.

There's a caching layer in place that should take care of that

-- 
http://www.bestpractical.com/rt  -- Trouble Ticketing. Free.



More information about the Rt-devel mailing list