From 2463869c9231702fd225f50a6ee620c7fb6facb8 Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 13 Nov 2008 21:21:29 +0000 Subject: [PATCH] use distinct flag to force an aggregate workaround check git-svn-id: svn://svn.open-ils.org/ILS/trunk@11174 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/SuperCat.pm | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 74382e91d9..ec5518b2c7 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -335,21 +335,18 @@ sub new_books_by_item { my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' ); - my $o_search = { shortname => $ou }; - if (!$ou || $ou eq '-') { - $o_search = { parent_ou => undef }; + my @ou_ids; + if ($ou && $ou ne '-') { + my $orgs = $_storage->request( + "open-ils.cstore.direct.actor.org_unit.search", + { shortname => $ou }, + { flesh => 10, + flesh_fields => { aou => [qw/children/] } + } + )->gather(1); + @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs; } - my $orgs = $_storage->request( - "open-ils.cstore.direct.actor.org_unit.search", - $o_search, - { flesh => 3, - flesh_fields => { aou => [qw/children/] } - } - )->gather(1); - - my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs; - $logger->debug("Searching for records with new copies at orgs [".join(',',@ou_ids)."], based on $ou"); my $cns = $_storage->request( "open-ils.cstore.json_query.atomic", @@ -363,7 +360,8 @@ sub new_books_by_item { }, order_by => { acp => { create_date => { transform => 'max', direction => 'desc' } } }, limit => $page_size, - offset => $offset + offset => $offset, + distinct => 1 } )->gather(1); -- 2.11.0