R3602 - in rt/branches/QUEBEC-EXPERIMENTAL: . lib/RT

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

I don’t see reason why you need LEFT JOIN for sorting. Could you show
us why we can’t use prev. solution.

Otherwise the JOINs required to give us a requestors column to sort on
leave out tickets that have no requestor; the LEFT JOINs give us nulls
in the requestor columns, instead of the JOINS which would eliminate the
row entirely. The patch hence fixes a problem where sorting by
requestor limited the tickets to those which had a requestor.

  • Alex

Ah, I thought there is LEFT joins already.On 8/18/05, Alex Vandiver alexmv@bestpractical.com wrote:

On Thu, 2005-08-18 at 17:25 +0600, Ruslan Zakirov wrote:

I don’t see reason why you need LEFT JOIN for sorting. Could you show
us why we can’t use prev. solution.

Otherwise the JOINs required to give us a requestors column to sort on
leave out tickets that have no requestor; the LEFT JOINs give us nulls
in the requestor columns, instead of the JOINS which would eliminate the
row entirely. The patch hence fixes a problem where sorting by
requestor limited the tickets to those which had a requestor.

  • Alex

Best regards, Ruslan.