add more tests to cover AssetLineage->getChildCount. Optimize the new SQL query in getChildCount

This commit is contained in:
Colin Kuskie 2007-11-20 21:15:06 +00:00
parent 0799d70428
commit 80333b1141
2 changed files with 12 additions and 2 deletions

View file

@ -187,7 +187,7 @@ sub getChildCount {
my $self = shift;
my $opts = shift || {};
my $stateWhere = $opts->{includeTrash} ? '' : "asset.state='published' and";
my ($count) = $self->session->db->quickArray("select count(asset.state) from asset, assetData where asset.assetId=assetData.assetId and $stateWhere parentId=? and assetData.status in ('approved', 'archived')", [$self->getId]);
my ($count) = $self->session->db->quickArray("select count(*) from asset, assetData where asset.assetId=assetData.assetId and $stateWhere parentId=? and assetData.status in ('approved', 'archived')", [$self->getId]);
return $count;
}