[Rt-devel] Re: r3602 - in rt/branches/QUEBEC-EXPERIMENTAL: . lib/RT

Ruslan Zakirov ruslan.zakirov at gmail.com
Thu Aug 18 07:25:47 EDT 2005


On 8/4/05, alexmv at bestpractical.com <alexmv at bestpractical.com> wrote:
> Author: alexmv
> Date: Thu Aug  4 13:41:33 2005
> New Revision: 3602
> 
> Modified:
>    rt/branches/QUEBEC-EXPERIMENTAL/   (props changed)
>    rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
>    rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Tickets_Overlay_SQL.pm
> Log:
>  r5644 at zoq-fot-pik:  chmrr | 2005-08-04 13:39:54 -0400
>   * Replace %FIELDS (which has pseudohash meaning) with %FIELD_METADATA
>   * Make join for sorting watchers be a left join
I don't see reason why you need LEFT JOIN for sorting. Could you show
us why we can't use prev. solution.

> 
> 
> Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Tickets_Overlay.pm
[snip]
> @@ -821,40 +821,34 @@
>      my $self  = shift;
>      my $type  = shift;
>      my $key   = shift || "limit";
> -    my $groups = $self->{ 'alias_' . $key . "_groups" } ||=
> -      $self->NewAlias('Groups');
> -    my $groupmembers =
> -      $self->{ 'alias_' . $key . "_groupmembers" } ||=
> -      $self->NewAlias('CachedGroupMembers');
> -    my $users = $self->{ 'alias_' . $key . "_users" } ||=
> -      $self->NewAlias('Users');
>  
> -    $self->SUPER::Limit(
> -        ALIAS           => $groups,
> -        FIELD           => 'Domain',
> -        VALUE           => 'RT::Ticket-Role',
> -        ENTRYAGGREGATOR => 'AND'
> -    );
> -    $self->Join(
> -        ALIAS1 => $groups,
> -        FIELD1 => 'Instance',
> -        ALIAS2 => 'main',
> -        FIELD2 => 'id'
> +    my $groups = $self->Join(
> +        TYPE   => 'left',
> +        ALIAS1 => 'main',
> +        FIELD1 => 'id',
> +        TABLE2 => 'Groups',
> +        FIELD2 => 'Instance'
>      );
> -    $self->Join(
> +    my $groupmembers = $self->Join(
>          ALIAS1 => $groups,
>          FIELD1 => 'id',
> -        ALIAS2 => $groupmembers,
> +        TABLE2 => 'CachedGroupMembers',
>          FIELD2 => 'GroupId'
>      );
> -    $self->Join(
> +    my $users = $self->Join(
>          ALIAS1 => $groupmembers,
>          FIELD1 => 'MemberId',
> -        ALIAS2 => $users,
> +        TABLE2 => 'Users',
>          FIELD2 => 'id'
>      );
>      $self->SUPER::Limit(
>          ALIAS           => $groups,
> +        FIELD           => 'Domain',
> +        VALUE           => 'RT::Ticket-Role',
> +        ENTRYAGGREGATOR => 'AND'
> +    );
> +    $self->SUPER::Limit(
> +        ALIAS           => $groups,
>          FIELD           => 'Type',
>          VALUE           => $type,
>          ENTRYAGGREGATOR => 'AND'
> @@ -956,7 +950,7 @@
>      # }}}
>  
>      # If we care about which sort of watcher
> -    my $meta = $FIELDS{$field};
> +    my $meta = $FIELD_METADATA{$field};
>      my $type = ( defined $meta->[1] ? $meta->[1] : undef );
>  
>      if ($type) {
> @@ -2503,9 +2497,9 @@
>          }
>  
>          die "I don't know about $field yet"
> -          unless ( exists $FIELDS{$realfield} or
> $restriction->{CUSTOMFIELD} );
> +          unless ( exists $FIELD_METADATA{$realfield} or
> $restriction->{CUSTOMFIELD} );
>  
> -        my $type = $FIELDS{$realfield}->[0];
> +        my $type = $FIELD_METADATA{$realfield}->[0];
>          my $op   = $restriction->{'OPERATOR'};
>  
>          my $value = (
> 
> Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Tickets_Overlay_SQL.pm
>
[snip]
-- 
Best regards, Ruslan.


More information about the Rt-devel mailing list