[open-ils-commits] [GIT] Evergreen ILS branch master updated. 0bef0c27c2e9f4eea85ef34e1a302aa847e785ba

Evergreen Git git at git.evergreen-ils.org
Fri Sep 1 18:05:28 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, master has been updated
       via  0bef0c27c2e9f4eea85ef34e1a302aa847e785ba (commit)
      from  f70f6f6c26342e35c8514b2660588144b6b8001d (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 0bef0c27c2e9f4eea85ef34e1a302aa847e785ba
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Fri Sep 1 17:33:50 2017 -0400

    LP#1714594: fix lp1629108_metarecord_constituent_result_reroute.pg
    
    This patch accounts for the fact that the IDs returned in source_list
    do not have a set order. It also no longer recreates unapi.mmr_mra()
    within the test case, meaning that it can now serve as a true regression
    test.
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>

diff --git a/Open-ILS/src/sql/Pg/t/regress/lp1629108_metarecord_constituent_result_reroute.pg b/Open-ILS/src/sql/Pg/t/regress/lp1629108_metarecord_constituent_result_reroute.pg
index 6e2fa3d..88f85b9 100755
--- a/Open-ILS/src/sql/Pg/t/regress/lp1629108_metarecord_constituent_result_reroute.pg
+++ b/Open-ILS/src/sql/Pg/t/regress/lp1629108_metarecord_constituent_result_reroute.pg
@@ -14,104 +14,6 @@ BEGIN;
 -- Plan the tests.
 SELECT plan(2);
 
--- Replace the function
-CREATE OR REPLACE FUNCTION unapi.mmr_mra (
-    obj_id BIGINT,
-    format TEXT,
-    ename TEXT,
-    includes TEXT[],
-    org TEXT,
-    depth INT DEFAULT NULL,
-    slimit HSTORE DEFAULT NULL,
-    soffset HSTORE DEFAULT NULL,
-    include_xmlns BOOL DEFAULT TRUE,
-    pref_lib INT DEFAULT NULL
-) RETURNS XML AS $F$
-    SELECT  XMLELEMENT(
-        name attributes,
-        XMLATTRIBUTES(
-            CASE WHEN $9 THEN 'http://open-ils.org/spec/indexing/v1' ELSE NULL END AS xmlns,
-            'tag:open-ils.org:U2 at mmr/' || $1 AS metarecord
-        ),
-        (SELECT XMLAGG(foo.y)
-          FROM (
-            WITH sourcelist AS (
-                WITH aou AS (SELECT COALESCE(id, (evergreen.org_top()).id) AS id
-                    FROM actor.org_unit WHERE shortname = $5 LIMIT 1)
-                SELECT source
-                FROM metabib.metarecord_source_map, aou
-                WHERE metarecord = $1 AND (
-                    EXISTS (
-                        SELECT 1 FROM asset.opac_visible_copies
-                        WHERE record = source AND circ_lib IN (
-                            SELECT id FROM actor.org_unit_descendants(aou.id, $6))
-                        LIMIT 1
-                    )
-                    OR EXISTS (SELECT 1 FROM located_uris(source, aou.id, $10) LIMIT 1)
-                )
-            )
-            SELECT  cmra.aid,
-                    XMLELEMENT(
-                        name field,
-                        XMLATTRIBUTES(
-                            cmra.attr AS name,
-                            cmra.value AS "coded-value",
-                            cmra.aid AS "cvmid",
-                            rad.composite,
-                            rad.multi,
-                            rad.filter,
-                            rad.sorter,
-                            cmra.source_list
-                        ),
-                        cmra.value
-                    )
-              FROM  (
-                SELECT DISTINCT aid, attr, value, STRING_AGG(x.id::TEXT, ',') AS source_list
-                  FROM (
-                    SELECT  v.source AS id,
-                            c.id AS aid,
-                            c.ctype AS attr,
-                            c.code AS value
-                      FROM  metabib.record_attr_vector_list v
-                            JOIN config.coded_value_map c ON ( c.id = ANY( v.vlist ) )
-                    ) AS x
-                    JOIN sourcelist ON (x.id = sourcelist.source)
-                    GROUP BY 1, 2, 3 
-                ) AS cmra
-                JOIN config.record_attr_definition rad ON (cmra.attr = rad.name)
-                UNION ALL
-            SELECT  umra.aid,
-                    XMLELEMENT(
-                        name field,
-                        XMLATTRIBUTES(
-                            umra.attr AS name,
-                            rad.composite,
-                            rad.multi,
-                            rad.filter,
-                            rad.sorter
-                        ),
-                        umra.value
-                    )
-              FROM  (
-                SELECT DISTINCT aid, attr, value
-                  FROM (
-                    SELECT  v.source AS id,
-                            m.id AS aid,
-                            m.attr AS attr,
-                            m.value AS value
-                      FROM  metabib.record_attr_vector_list v
-                            JOIN metabib.uncontrolled_record_attr_value m ON ( m.id = ANY( v.vlist ) )
-                    ) AS x
-                    JOIN sourcelist ON (x.id = sourcelist.source)
-                ) AS umra
-                JOIN config.record_attr_definition rad ON (umra.attr = rad.name)
-                ORDER BY 1
-
-            )foo(id,y)
-        )
-    )
-$F$ LANGUAGE SQL STABLE;
-
 -- Now make sure that the a query against it doesn't break
 PREPARE thrower AS select mmr_mra::varchar from unapi.mmr_mra
 (240,'','',null::text[],'CONS',0,null::HSTORE,null::HSTORE,true,1);
@@ -121,7 +23,8 @@ SELECT performs_ok( 'thrower',250,'Generic check for unapi.mmr_mra breakage' );
 -- Make sure that the function returns the new XML property source_list
 SELECT is(  
 (
-select mmr_mra::varchar ~ 'source_list="242,243,244"' from unapi.mmr_mra
+select mmr_mra::varchar ~ 'source_list="24[234],24[234],24[234]"'
+from unapi.mmr_mra
 (240,'','',null::text[],'CONS',0,null::HSTORE,null::HSTORE,true,1)
 ), true, 'unapi.mmr_mra results have source_list="242,243,244sfaf"' );
 

-----------------------------------------------------------------------

Summary of changes:
 ...629108_metarecord_constituent_result_reroute.pg |  101 +-------------------
 1 files changed, 2 insertions(+), 99 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list