RT or SearchBuilder bug?

$QueueObj->TicketCustomFields->Count includes disabled fields in it’s
Count. Should that be?

If I do it this way:

my $cfs = $QueueObj->TicketCustomFields;
$cfs->ItemsArrayRef;
my $count = $cfsw->Count;

the the correct number is returned.

SB version 1.48, RT version 3.6.3

Is my technique wrong or is there a bug?

-Todd

$QueueObj->TicketCustomFields->Count includes disabled fields in
it’s Count. Should that be?

If I do it this way:

my $cfs = $QueueObj->TicketCustomFields;
$cfs->ItemsArrayRef;
my $count = $cfsw->Count;

the the correct number is returned.

SB version 1.48, RT version 3.6.3

Is my technique wrong or is there a bug?

This is the same issue you see when doing a ticket search in RT.
“Count” does a raw COUNT() in the database if you haven’t previously
actually loaded all the data from the database. Otherwise, it counts
the rows on the perl side.

ItemsArrayRef fully instantiates the list.

You could get the same behaviour by calling:

$cfs->First; $cfs->Count;

Jesse,

But this isn’t a matter of permissions checking. If iterating over the query
results skips disabled rows then Count should be able to eliminate them too.
Right?

-ToddOn Tue, Sep 16, 2008 at 12:56 PM, Jesse Vincent jesse@bestpractical.comwrote:

On Sep 16, 2008, at 11:41 AM, Todd Chapman wrote:

$QueueObj->TicketCustomFields->Count includes disabled fields in it’s

Count. Should that be?

If I do it this way:

my $cfs = $QueueObj->TicketCustomFields;
$cfs->ItemsArrayRef;
my $count = $cfsw->Count;

the the correct number is returned.

SB version 1.48, RT version 3.6.3

Is my technique wrong or is there a bug?

This is the same issue you see when doing a ticket search in RT. "Count"
does a raw COUNT() in the database if you haven’t previously actually loaded
all the data from the database. Otherwise, it counts the rows on the perl
side.

ItemsArrayRef fully instantiates the list.

You could get the same behaviour by calling:

$cfs->First; $cfs->Count;

Jesse,

But this isn’t a matter of permissions checking. If iterating over
the query results skips disabled rows then Count should be able to
eliminate them too. Right?

I’m sure it could be made to do so, yeah. But the disabledness is
only one manifestation of the issue.