[open-ils-commits] [GIT] Evergreen ILS branch master updated. 05e9a0825c0e5d8909e0d92697725de97ecc6281

Evergreen Git git at git.evergreen-ils.org
Tue Feb 16 16:04:29 EST 2016


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  05e9a0825c0e5d8909e0d92697725de97ecc6281 (commit)
      from  c1b64bff4dcd59cc041eeb9227defbded5371bb7 (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 05e9a0825c0e5d8909e0d92697725de97ecc6281
Author: Chris Sharp <csharp at georgialibraries.org>
Date:   Wed Dec 16 07:10:37 2015 -0500

    LP#1486592 - Generate prices for concerto dataset.
    
    The "concerto" test data needs prices on copies to test
    various features. This adds a function to generate a price
    when a copy is populated.
    
    To test:
    
    [1] Create a fresh Evergreen database and load the Concerto
        dataset; verify that that vast majority of copies now
        have a price set.
    
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Ben Shum <ben at evergreener.net>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/Open-ILS/tests/datasets/sql/env_create.sql b/Open-ILS/tests/datasets/sql/env_create.sql
index 52c3603..ad5ba85 100644
--- a/Open-ILS/tests/datasets/sql/env_create.sql
+++ b/Open-ILS/tests/datasets/sql/env_create.sql
@@ -64,6 +64,15 @@ RETURNS void AS $$
     SELECT evergreen.populate_call_number($1, $2, $3, NULL);
 $$ LANGUAGE SQL;
 
+/*
+ * Each copy needs a price to be able to test lost/longoverdue and other
+ * real-life situations. Randomly generate a price between 1.99 and 25.99.
+ */
+CREATE OR REPLACE FUNCTION evergreen.generate_price() RETURNS FLOAT AS $$
+BEGIN
+        RETURN trunc(random() * 25 + 1) + .99;
+END;
+$$ LANGUAGE 'plpgsql';
 
 /*
  * create a copy for every callnumber in the database whose label and owning_lib 
@@ -72,8 +81,8 @@ $$ LANGUAGE SQL;
 CREATE FUNCTION evergreen.populate_copy 
     (circlib INTEGER, ownlib INTEGER, barcode TEXT, label TEXT)
 RETURNS void AS $$
-    INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, barcode)
-        SELECT id, $1, 1, 1, 1, 1, $3 || id::text
+    INSERT INTO asset.copy (call_number, circ_lib, creator, editor, loan_duration, fine_level, price, barcode)
+        SELECT id, $1, 1, 1, 1, 1, (SELECT evergreen.generate_price()), $3 || id::text
         FROM asset.call_number
         WHERE record > 0 AND label LIKE $4 || '%' AND owning_lib = $2;
 $$ LANGUAGE SQL;
diff --git a/Open-ILS/tests/datasets/sql/env_destroy.sql b/Open-ILS/tests/datasets/sql/env_destroy.sql
index 3fec691..9b51ab7 100644
--- a/Open-ILS/tests/datasets/sql/env_destroy.sql
+++ b/Open-ILS/tests/datasets/sql/env_destroy.sql
@@ -4,6 +4,7 @@ DROP TABLE marcxml_import;
 DROP FUNCTION evergreen.create_aou_address(INTEGER, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT);
 DROP FUNCTION evergreen.populate_call_number(INTEGER, TEXT, TEXT);
 DROP FUNCTION evergreen.populate_call_number(INTEGER, TEXT, TEXT, INTEGER);
+DROP FUNCTION evergreen.generate_price();
 DROP FUNCTION evergreen.populate_copy(INTEGER, INTEGER, TEXT, TEXT);
 DROP FUNCTION evergreen.next_copy (BIGINT);
 DROP FUNCTION evergreen.next_bib (BIGINT);

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

Summary of changes:
 Open-ILS/tests/datasets/sql/env_create.sql  |   13 +++++++++++--
 Open-ILS/tests/datasets/sql/env_destroy.sql |    1 +
 2 files changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list