[open-ils-commits] [GIT] Evergreen ILS branch rel_2_11 updated. f79f727e77096d1bf760c733d88f6a3e4bc97e2f
Evergreen Git
git at git.evergreen-ils.org
Mon Jul 24 11:10:47 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_11 has been updated
via f79f727e77096d1bf760c733d88f6a3e4bc97e2f (commit)
from e2d669c6044c5e99ac5fc07f4aff09d2e3b134dd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f79f727e77096d1bf760c733d88f6a3e4bc97e2f
Author: Mike Rylander <mrylander at gmail.com>
Date: Tue Feb 14 15:59:53 2017 -0500
LP#1664715: Hold ratio template ignores some copies
The relatively new report template "Hold/Copy Ratio per Bib and Pickup Library
(and Descendants)" only includes copies that are at locations that are
actually pickup libraries of holds. For instance, if you have two branches (A
and B) in a system, each with 10 copies attached to a bib, but a hold only at
branch A, the ratio calculated at the system level sees 10 copies rather than
twenty. This has the effect of inflating the hold side of the hold/copy ratio.
The SQL definition is adjusted here to count copies across the entire branch
of the org tree per bib, rather than through a join that restricts to those
branches that are pickup libraries for a relevant hold.
Upgrade note: Report templates using the Hold/Copy Ratio at Pickup Library
and Descendants data source will need to be re-created to benefit from this
bug fix.
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Signed-off-by: Josh Stompro <stomproj at larl.org>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 44e63b3..e468a88 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -10709,27 +10709,27 @@ SELECT usr,
<class id="rhcrpbapd" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="reporter::hold_copy_ratio_per_bib_and_pickup_desc" oils_persist:readonly="true" reporter:label="Hold/Copy Ratio per Bib and Pickup Library (and Descendants) ">
<oils_persist:source_definition>
WITH counts_at_ou AS (
- SELECT bib_record, pickup_lib, count(DISTINCT ahr.id) AS holds_at_pickup_library,
- COALESCE(count(DISTINCT ac.id),0) as copy_count_at_pickup_library
- FROM action.hold_request ahr
- JOIN reporter.hold_request_record rhrr USING (id)
- LEFT JOIN action.hold_copy_map ahcm ON (ahr.id = ahcm.hold)
- LEFT JOIN asset.copy ac ON (ahcm.target_copy = ac.id AND ahr.pickup_lib = ac.circ_lib)
- WHERE ahr.cancel_time IS NULL
- AND ahr.fulfillment_time IS NULL
- GROUP BY bib_record, pickup_lib
+ SELECT rhrr.bib_record AS id,
+ aou.id AS pickup_lib_or_desc,
+ COUNT(DISTINCT ahr.id) AS holds_at_or_below,
+ COALESCE(COUNT(DISTINCT ac.id),0) AS copy_count_at_or_below
+ FROM actor.org_unit aou
+ JOIN actor.org_unit_type aout ON (aou.ou_type = aout.id),
+ action.hold_request ahr
+ JOIN reporter.hold_request_record rhrr USING (id)
+ LEFT JOIN action.hold_copy_map ahcm ON (ahr.id = ahcm.hold)
+ LEFT JOIN asset.copy ac ON (ahcm.target_copy = ac.id)
+ WHERE ahr.cancel_time IS NULL AND ahr.fulfillment_time IS NULL
+ AND ac.circ_lib IN (SELECT id FROM actor.org_unit_descendants(aou.id))
+ AND (actor.org_unit_ancestor_at_depth(ahr.pickup_lib,aout.depth)).id = (actor.org_unit_ancestor_at_depth(ac.circ_lib,aout.depth)).id
+ GROUP BY 1, 2
)
- SELECT *,
- CASE WHEN copy_count_at_or_below = 0 THEN 'Infinity'::FLOAT ELSE holds_at_or_below::FLOAT/copy_count_at_or_below END AS hold_copy_ratio_at_or_below_ou,
- CASE WHEN copy_count_everywhere = 0 THEN 'Infinity'::FLOAT ELSE holds_everywhere::FLOAT/copy_count_everywhere END AS everywhere_ratio
- FROM
- (SELECT bib_record AS id, aou.id AS pickup_lib_or_desc, SUM(holds_at_pickup_library) AS holds_at_or_below, SUM(copy_count_at_pickup_library) AS copy_count_at_or_below
- FROM actor.org_unit aou
- JOIN counts_at_ou cao ON (cao.pickup_lib IN (SELECT id FROM actor.org_unit_descendants(aou.id)))
- GROUP BY bib_record, pickup_lib_or_desc
- )x
- JOIN
- (SELECT bib_record AS id, count(DISTINCT ahr.id) AS holds_everywhere, COALESCE(count(DISTINCT target_copy),0) as copy_count_everywhere
+ SELECT x.id, x.pickup_lib_or_desc, x.holds_at_or_below, x.copy_count_at_or_below,
+ y.holds_everywhere, y.copy_count_everywhere,
+ CASE WHEN copy_count_at_or_below = 0 THEN 'Infinity'::FLOAT ELSE x.holds_at_or_below::FLOAT/x.copy_count_at_or_below END AS hold_copy_ratio_at_or_below_ou,
+ CASE WHEN copy_count_everywhere = 0 THEN 'Infinity'::FLOAT ELSE y.holds_everywhere::FLOAT/y.copy_count_everywhere END AS everywhere_ratio
+ FROM counts_at_ou x
+ JOIN (SELECT bib_record AS id, count(DISTINCT ahr.id) AS holds_everywhere, COALESCE(count(DISTINCT target_copy),0) as copy_count_everywhere
FROM
action.hold_request ahr
JOIN reporter.hold_request_record rhrr USING (id)
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/examples/fm_IDL.xml | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list