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

Evergreen Git git at git.evergreen-ils.org
Wed Feb 24 14:28:46 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  b4415faed29799de99ac901cdb852ffce9ec9748 (commit)
       via  6d24cb9a1b3245ce8e97491503c3b8cc0e48fe9e (commit)
      from  56cf5c5312e11abe5f2c30395acc64e6a2c52002 (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 b4415faed29799de99ac901cdb852ffce9ec9748
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Wed Feb 24 14:27:15 2016 -0500

    LP#1206936 Stamping upgrade script; adding test
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index a4f3851..7f19216 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0958', :eg_version); -- gmcharlt/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0959', :eg_version); -- csharp/dbwells
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/live_t/0959.schema.correct_mtbs_view.pg b/Open-ILS/src/sql/Pg/live_t/0959.schema.correct_mtbs_view.pg
new file mode 100644
index 0000000..65f5031
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/live_t/0959.schema.correct_mtbs_view.pg
@@ -0,0 +1,48 @@
+\set ECHO 'none'
+\set QUIET 1
+-- Turn off echo and keep things quiet.
+
+-- Format the output for nice TAP.
+\pset format unaligned
+\pset tuples_only true
+\pset pager
+
+-- Revert all changes on failure.
+\set ON_ERROR_ROLLBACK 1
+\set ON_ERROR_STOP true
+
+-- let's do this thing
+BEGIN;
+
+-- putting tests in function to allow for variable reuse
+CREATE OR REPLACE FUNCTION mtbs_test() RETURNS SETOF TEXT AS $$
+DECLARE
+	max_id bigint;
+BEGIN
+
+RETURN QUERY SELECT plan(2);
+
+SELECT max(mbx.id) INTO max_id
+FROM money.billable_xact mbx
+JOIN money.billing mb ON NOT mb.voided AND mb.xact = mbx.id;
+
+RETURN QUERY SELECT is(
+    (SELECT DISTINCT ON (xact) billing_type FROM money.billing WHERE xact = max_id ORDER BY xact, billing_ts DESC),
+    (SELECT last_billing_type FROM money.transaction_billing_summary WHERE xact = max_id),
+    'mtbs has correct last billing type'
+);
+
+RETURN QUERY SELECT is(
+    (SELECT DISTINCT ON (xact) note FROM money.billing WHERE xact = max_id ORDER BY xact, billing_ts DESC),
+    (SELECT last_billing_note FROM money.transaction_billing_summary WHERE xact = max_id),
+    'mtbs has correct last billing note'
+);
+
+RETURN QUERY SELECT * FROM finish();
+
+END;
+$$ LANGUAGE plpgsql;
+
+SELECT mtbs_test();
+
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql b/Open-ILS/src/sql/Pg/upgrade/0959.schema.correct_mtbs_view.sql
similarity index 79%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql
rename to Open-ILS/src/sql/Pg/upgrade/0959.schema.correct_mtbs_view.sql
index c45b3c6..f2b6e53 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0959.schema.correct_mtbs_view.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0959', :eg_version);
 
 CREATE OR REPLACE VIEW money.transaction_billing_summary AS
     SELECT id as xact,

commit 6d24cb9a1b3245ce8e97491503c3b8cc0e48fe9e
Author: Chris Sharp <csharp at georgialibraries.org>
Date:   Mon Nov 30 09:48:26 2015 -0500

    LP#1206936 - Fix wrong billing info in money.transaction_billing_summary
    
    The money.transaction_billing_summary view was showing the wrong
    last billing type and last billing note for certain transactions.
    This fix, from Dan Scott, in turn from Mike Rylander, recreates
    that view so that it depends on the speedier and more accurate
    money.materialized_billable_xact_summary view.
    
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql
index e67c0a7..19a88c7 100644
--- a/Open-ILS/src/sql/Pg/080.schema.money.sql
+++ b/Open-ILS/src/sql/Pg/080.schema.money.sql
@@ -95,15 +95,13 @@ CREATE OR REPLACE VIEW money.transaction_billing_type_summary AS
 	  ORDER BY MAX(billing_ts);
 
 CREATE OR REPLACE VIEW money.transaction_billing_summary AS
-	SELECT	xact,
-		LAST(billing_type) AS last_billing_type,
-		LAST(note) AS last_billing_note,
-		MAX(billing_ts) AS last_billing_ts,
-		SUM(COALESCE(amount,0)) AS total_owed
-	  FROM	money.billing
-	  WHERE	voided IS FALSE
-	  GROUP BY xact
-	  ORDER BY MAX(billing_ts);
+    SELECT id as xact,
+        last_billing_type,
+        last_billing_note,
+        last_billing_ts,
+        total_owed
+      FROM money.materialized_billable_xact_summary;            
+
 
 CREATE OR REPLACE VIEW money.transaction_payment_summary AS
 	SELECT	xact,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql
new file mode 100644
index 0000000..c45b3c6
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.correct_mtbs_view.sql
@@ -0,0 +1,13 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+CREATE OR REPLACE VIEW money.transaction_billing_summary AS
+    SELECT id as xact,
+        last_billing_type,
+        last_billing_note,
+        last_billing_ts,
+        total_owed
+      FROM money.materialized_billable_xact_summary;
+
+COMMIT;

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/080.schema.money.sql           |   16 +++----
 .../sql/Pg/live_t/0959.schema.correct_mtbs_view.pg |   48 ++++++++++++++++++++
 .../Pg/upgrade/0959.schema.correct_mtbs_view.sql   |   13 +++++
 4 files changed, 69 insertions(+), 10 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/live_t/0959.schema.correct_mtbs_view.pg
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0959.schema.correct_mtbs_view.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list