[open-ils-commits] [GIT] Evergreen ILS branch master updated. 36e9ecc7cf3132935eb3994c2ce9fdd4771adf50

Evergreen Git git at git.evergreen-ils.org
Fri Jul 24 10:19:52 EDT 2015


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  36e9ecc7cf3132935eb3994c2ce9fdd4771adf50 (commit)
       via  406d79e765a2ad318af1005f36d4dd983761c9b7 (commit)
       via  58aecfdf92c225dbfc960a109de740e68dfa109f (commit)
      from  b5a0a740ed9387b04326ab4ba190ec1c26320a81 (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 36e9ecc7cf3132935eb3994c2ce9fdd4771adf50
Author: Bill Erickson <berick at esilibrary.com>
Date:   Tue Apr 2 17:22:37 2013 -0400

    LP#1155771 Copy location sample data additions
    
    * added some new locations and better groups (thanks gdunbar)
    * applying locations to copies in a slightly more sane fashion
    * added todo comment about possible future improvement
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/tests/datasets/sql/assets_extras.sql b/Open-ILS/tests/datasets/sql/assets_extras.sql
index b57c016..24609de 100644
--- a/Open-ILS/tests/datasets/sql/assets_extras.sql
+++ b/Open-ILS/tests/datasets/sql/assets_extras.sql
@@ -3,11 +3,27 @@
 -- copy stat cats
 -- ...
 
+-- TODO:
+-- This applies locations to copies without regard for the type
+-- of record of each copy.  This leads to nonsensical copy / location 
+-- pairings.  (E.g. a violin concerto copy with a "Newspapers" location).  
+-- An improvement would be to create locations first, then select
+-- locations for copies as they are inserted.  Time will tell if there will
+-- ever be a large enough variety of data to do this in a meaningful way.
+-- Also, it's kind of a pain, so, maybe later..
+
 INSERT INTO asset.copy_location (owning_lib, name) VALUES
+(1, 'Reference'),
+(4, 'Reference'),
+(4, 'Easy Reader'),
+(5, 'Easy Reader'),
+(6, 'Easy Reader'),
 (2, 'Fiction'),
 (3, 'Fiction'),
 (2, 'Non-Fiction'),
 (3, 'Non-Fiction'),
+(2, 'Juvenile Non-Fiction'),
+(3, 'Juvenile Non-Fiction'),
 (2, 'Young Adult Fiction'),
 (4, 'Young Adult Fiction'),
 (5, 'Young Adult Fiction'),
@@ -26,7 +42,29 @@ INSERT INTO asset.copy_location (owning_lib, name) VALUES
 (4, 'Biography'),
 (5, 'Biography'),
 (6, 'Local History'),
-(7, 'Local History');
+(7, 'Local History'),
+(6, 'Federal Documents');
+
+
+-- non-holdable, non-circulating
+INSERT INTO asset.copy_location 
+    (owning_lib, name, holdable, circulate) VALUES
+(4, 'Periodicals', FALSE, FALSE),
+(6, 'Periodicals', FALSE, FALSE),
+(5, 'Magazines', FALSE, FALSE),
+(7, 'Magazines', FALSE, FALSE),
+(4, 'Newspapers', FALSE, FALSE);
+
+-- non-holdable
+INSERT INTO asset.copy_location (owning_lib, name, holdable) VALUES
+(4, 'Reserves', FALSE),
+(5, 'Reserves', FALSE),
+(3, 'Reserves', FALSE),
+(5, 'Theses', FALSE),
+(7, 'Theses', FALSE),
+(2, 'Special Collections', FALSE),
+(6, 'Special Collections', FALSE),
+(7, 'Special Collections', FALSE);
 
 
 -- different settings per org level
@@ -44,19 +82,34 @@ INSERT INTO asset.copy_location
 
 -- copy location groups
 
-INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys1 Fiction', 2);
+INSERT INTO asset.copy_location_group (name, owner) 
+    VALUES ('Juvenile Collection', 2);
 
 INSERT INTO asset.copy_location_group_map (lgroup, location)
     SELECT CURRVAL('asset.copy_location_group_id_seq'), id
         FROM asset.copy_location 
-        WHERE owning_lib in (2, 4, 5) AND opac_visible;
+        WHERE owning_lib IN (2, 4, 5) AND 
+            opac_visible AND 
+            name IN (
+                'Young Adult Fiction', 
+                'Children''s Fiction',
+                'Easy Reader', 
+                'Juvenile Non-Fiction'
+            );
 
-INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys2 Fiction', 2);
+INSERT INTO asset.copy_location_group (name, owner) 
+    VALUES ('Local Interest Collection', 3);
 
 INSERT INTO asset.copy_location_group_map (lgroup, location)
     SELECT CURRVAL('asset.copy_location_group_id_seq'), id
         FROM asset.copy_location 
-        WHERE owning_lib in (3, 6, 7) AND opac_visible;
+        WHERE owning_lib IN (3, 6, 7) AND 
+            opac_visible AND
+            name IN (
+                'Geneology',
+                'Special Collections',
+                'Local History'
+            );
 
 -- Distribute copies evenly across copy locations whose owning_lib
 -- matches the copy circ lib.  To provide some level of repeatable
@@ -65,28 +118,39 @@ INSERT INTO asset.copy_location_group_map (lgroup, location)
 DO $$
     DECLARE cur_loc INTEGER;
     DECLARE cur_copy asset.copy%ROWTYPE;
+    DECLARE cur_cn INTEGER;
 BEGIN
     cur_loc := 0;
+    cur_cn := 0;
 
     FOR cur_copy IN SELECT * FROM asset.copy 
-            WHERE location = 1 ORDER BY circ_lib, id LOOP
+            WHERE location = 1 ORDER BY circ_lib, call_number, id LOOP
 
-        -- find the next location for the current copy's circ lib
-        SELECT INTO cur_loc id FROM asset.copy_location 
-            WHERE owning_lib = cur_copy.circ_lib AND id > cur_loc 
-            ORDER BY id LIMIT 1;
+        -- Move to the next copy location if we are changing call numbers.
+        -- This provides some visual consistency between call numbers and
+        -- copy locations and helps avoid having practically every copy in
+        -- view residing in a different location.
+        IF cur_cn <> cur_copy.call_number THEN
 
-        IF NOT FOUND THEN
-            -- start back over at the front of the list
-            cur_loc := 0;
+            -- find the next location for the current copy's circ lib
             SELECT INTO cur_loc id FROM asset.copy_location 
                 WHERE owning_lib = cur_copy.circ_lib AND id > cur_loc 
                 ORDER BY id LIMIT 1;
-        END IF;
 
-        IF NOT FOUND THEN
-            -- no copy location at this circ lib, leave the default (1)
-            CONTINUE;
+            IF NOT FOUND THEN
+                -- start back over at the front of the list
+                cur_loc := 0;
+                SELECT INTO cur_loc id FROM asset.copy_location 
+                    WHERE owning_lib = cur_copy.circ_lib AND id > cur_loc 
+                    ORDER BY id LIMIT 1;
+            END IF;
+
+            IF NOT FOUND THEN
+                -- no copy location at this circ lib, leave the default (1)
+                CONTINUE;
+            END IF;
+
+            cur_cn := cur_copy.call_number;
         END IF;
 
         UPDATE asset.copy SET location = cur_loc WHERE id = cur_copy.id;

commit 406d79e765a2ad318af1005f36d4dd983761c9b7
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Mar 18 11:01:36 2013 -0400

    LP#1155771 Copy location sample data additions
    
    * Add/remove some locations
    * Add some locations whose flags (circulate, etc.) vary along the org
      pathway.  Thanks to Thomas Berezansky for this suggestion.
    * Ensure that copy location owner matches copy circ lib when applying
      locations to copies.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/tests/datasets/sql/assets_extras.sql b/Open-ILS/tests/datasets/sql/assets_extras.sql
index 2efefb9..b57c016 100644
--- a/Open-ILS/tests/datasets/sql/assets_extras.sql
+++ b/Open-ILS/tests/datasets/sql/assets_extras.sql
@@ -4,35 +4,43 @@
 -- ...
 
 INSERT INTO asset.copy_location (owning_lib, name) VALUES
-(4, 'Adult'),
-(4, 'Young Adult'),
-(4, 'Juvenile'),
-(4, 'AV'),
-(4, 'Children''s AV'),
-(5, 'Western'),
-(5, 'Young Adult'),
+(2, 'Fiction'),
+(3, 'Fiction'),
+(2, 'Non-Fiction'),
+(3, 'Non-Fiction'),
+(2, 'Young Adult Fiction'),
+(4, 'Young Adult Fiction'),
+(5, 'Young Adult Fiction'),
+(6, 'Young Adult Fiction'),
+(2, 'Children''s Fiction'),
+(3, 'Children''s Fiction'),
+(4, 'Audio/Video'),
+(5, 'Audio/Video'),
+(5, 'Music'),
+(6, 'Music'),
+(6, 'Audio/Video'),
+(4, 'Science Fiction'),
+(7, 'Science Fiction'),
 (5, 'Genealogy'),
-(5, 'Local History'),
-(6, 'Sci-Fi'),
-(6, 'Biography'),
-(6, 'Ninjas'),
-(6, 'Young Adult'),
-(7, 'Vampires'),
-(7, 'Western'),
-(7, 'Young Adult'),
-(7, 'Sports');
+(6, 'Genealogy'),
+(4, 'Biography'),
+(5, 'Biography'),
+(6, 'Local History'),
+(7, 'Local History');
 
--- non-holable
-INSERT INTO asset.copy_location (owning_lib, name, holdable) VALUES
-(4, 'New Arrivals', FALSE);
 
--- non-holable, non-cirulcateable, non-visible
+-- different settings per org level
 INSERT INTO asset.copy_location
     (owning_lib, name, holdable, opac_visible, circulate) VALUES
-(5, 'Display', FALSE, FALSE, FALSE),
-(6, 'Display', FALSE, FALSE, FALSE),
-(7, 'Display', FALSE, FALSE, FALSE);
-
+(2, 'Display', FALSE, FALSE, TRUE),
+(4, 'Display', FALSE, FALSE, FALSE),
+(5, 'Display', TRUE, FALSE, FALSE),
+(6, 'Display', TRUE, FALSE, FALSE),
+(7, 'Display', FALSE, FALSE, FALSE),
+(1, 'New Arrivals', TRUE, TRUE, TRUE),
+(2, 'New Arrivals', FALSE, TRUE, TRUE),
+(4, 'New Arrivals', TRUE, TRUE, FALSE),
+(5, 'New Arrivals', TRUE, TRUE, TRUE);
 
 -- copy location groups
 
@@ -40,30 +48,48 @@ INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys1 Fiction', 2);
 
 INSERT INTO asset.copy_location_group_map (lgroup, location)
     SELECT CURRVAL('asset.copy_location_group_id_seq'), id
-        FROM asset.copy_location WHERE owning_lib in (4, 5)
-        AND opac_visible;
+        FROM asset.copy_location 
+        WHERE owning_lib in (2, 4, 5) AND opac_visible;
 
 INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys2 Fiction', 2);
 
 INSERT INTO asset.copy_location_group_map (lgroup, location)
     SELECT CURRVAL('asset.copy_location_group_id_seq'), id
-        FROM asset.copy_location WHERE owning_lib in (6, 7)
-        AND opac_visible;
-
--- evenly distribute the copies across all of the copy locations.
--- there's probably a more effecient way, but this gets the job done
+        FROM asset.copy_location 
+        WHERE owning_lib in (3, 6, 7) AND opac_visible;
 
+-- Distribute copies evenly across copy locations whose owning_lib
+-- matches the copy circ lib.  To provide some level of repeatable
+-- outcome, we loop instead of applying locations at randon within
+-- a given owning_lib.
 DO $$
     DECLARE cur_loc INTEGER;
     DECLARE cur_copy asset.copy%ROWTYPE;
 BEGIN
-    cur_copy := evergreen.next_copy(0);
+    cur_loc := 0;
+
+    FOR cur_copy IN SELECT * FROM asset.copy 
+            WHERE location = 1 ORDER BY circ_lib, id LOOP
+
+        -- find the next location for the current copy's circ lib
+        SELECT INTO cur_loc id FROM asset.copy_location 
+            WHERE owning_lib = cur_copy.circ_lib AND id > cur_loc 
+            ORDER BY id LIMIT 1;
 
-    WHILE cur_copy.id IS NOT NULL LOOP
-        FOR cur_loc IN SELECT id FROM asset.copy_location ORDER BY id LOOP
-            UPDATE asset.copy SET location = cur_loc WHERE id = cur_copy.id;
-            cur_copy := evergreen.next_copy(cur_copy.id);
-            EXIT WHEN cur_copy.id IS NULL;
-        END LOOP;
+        IF NOT FOUND THEN
+            -- start back over at the front of the list
+            cur_loc := 0;
+            SELECT INTO cur_loc id FROM asset.copy_location 
+                WHERE owning_lib = cur_copy.circ_lib AND id > cur_loc 
+                ORDER BY id LIMIT 1;
+        END IF;
+
+        IF NOT FOUND THEN
+            -- no copy location at this circ lib, leave the default (1)
+            CONTINUE;
+        END IF;
+
+        UPDATE asset.copy SET location = cur_loc WHERE id = cur_copy.id;
     END LOOP;
 END $$;
+

commit 58aecfdf92c225dbfc960a109de740e68dfa109f
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Mar 15 14:32:18 2013 -0400

    LP#1155771 Sample data : copy locations, location groups
    
    Adds a pile of sample copy location and location groups to the sample
    data in Open-ILS/tests/datasets/sql.  Samples are loaded as part of
    "load_all.sql"
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/tests/datasets/sql/assets_extras.sql b/Open-ILS/tests/datasets/sql/assets_extras.sql
new file mode 100644
index 0000000..2efefb9
--- /dev/null
+++ b/Open-ILS/tests/datasets/sql/assets_extras.sql
@@ -0,0 +1,69 @@
+-- copy locations
+-- copy location groups
+-- copy stat cats
+-- ...
+
+INSERT INTO asset.copy_location (owning_lib, name) VALUES
+(4, 'Adult'),
+(4, 'Young Adult'),
+(4, 'Juvenile'),
+(4, 'AV'),
+(4, 'Children''s AV'),
+(5, 'Western'),
+(5, 'Young Adult'),
+(5, 'Genealogy'),
+(5, 'Local History'),
+(6, 'Sci-Fi'),
+(6, 'Biography'),
+(6, 'Ninjas'),
+(6, 'Young Adult'),
+(7, 'Vampires'),
+(7, 'Western'),
+(7, 'Young Adult'),
+(7, 'Sports');
+
+-- non-holable
+INSERT INTO asset.copy_location (owning_lib, name, holdable) VALUES
+(4, 'New Arrivals', FALSE);
+
+-- non-holable, non-cirulcateable, non-visible
+INSERT INTO asset.copy_location
+    (owning_lib, name, holdable, opac_visible, circulate) VALUES
+(5, 'Display', FALSE, FALSE, FALSE),
+(6, 'Display', FALSE, FALSE, FALSE),
+(7, 'Display', FALSE, FALSE, FALSE);
+
+
+-- copy location groups
+
+INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys1 Fiction', 2);
+
+INSERT INTO asset.copy_location_group_map (lgroup, location)
+    SELECT CURRVAL('asset.copy_location_group_id_seq'), id
+        FROM asset.copy_location WHERE owning_lib in (4, 5)
+        AND opac_visible;
+
+INSERT INTO asset.copy_location_group (name, owner) VALUES ('Sys2 Fiction', 2);
+
+INSERT INTO asset.copy_location_group_map (lgroup, location)
+    SELECT CURRVAL('asset.copy_location_group_id_seq'), id
+        FROM asset.copy_location WHERE owning_lib in (6, 7)
+        AND opac_visible;
+
+-- evenly distribute the copies across all of the copy locations.
+-- there's probably a more effecient way, but this gets the job done
+
+DO $$
+    DECLARE cur_loc INTEGER;
+    DECLARE cur_copy asset.copy%ROWTYPE;
+BEGIN
+    cur_copy := evergreen.next_copy(0);
+
+    WHILE cur_copy.id IS NOT NULL LOOP
+        FOR cur_loc IN SELECT id FROM asset.copy_location ORDER BY id LOOP
+            UPDATE asset.copy SET location = cur_loc WHERE id = cur_copy.id;
+            cur_copy := evergreen.next_copy(cur_copy.id);
+            EXIT WHEN cur_copy.id IS NULL;
+        END LOOP;
+    END LOOP;
+END $$;
diff --git a/Open-ILS/tests/datasets/sql/load_all.sql b/Open-ILS/tests/datasets/sql/load_all.sql
index 22947fc..c9f2da4 100644
--- a/Open-ILS/tests/datasets/sql/load_all.sql
+++ b/Open-ILS/tests/datasets/sql/load_all.sql
@@ -49,6 +49,9 @@ INSERT INTO biblio.record_entry (marc, last_xact_id)
 -- load RDA copies, etc.
 \i assets_rda.sql
 
+-- load copy-related data
+\i assets_extras.sql
+
 -- load sample patrons
 \i users_patrons_100.sql
 

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

Summary of changes:
 Open-ILS/tests/datasets/sql/assets_extras.sql |  159 +++++++++++++++++++++++++
 Open-ILS/tests/datasets/sql/load_all.sql      |    3 +
 2 files changed, 162 insertions(+), 0 deletions(-)
 create mode 100644 Open-ILS/tests/datasets/sql/assets_extras.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list