[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. 93c98586b1a4e7fa93c92b852e9491bf3ef12327

Evergreen Git git at git.evergreen-ils.org
Tue Nov 15 16:18:28 EST 2011


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_0 has been updated
       via  93c98586b1a4e7fa93c92b852e9491bf3ef12327 (commit)
       via  94ad57aaa69534d0541406de6afa721a7f4ec9d4 (commit)
       via  a3b8fb1d6057adacf9136690bfc1143c3b1dac9e (commit)
      from  a6ed9cb87f4ab7fe24251e46fd2506e7d19a7087 (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 93c98586b1a4e7fa93c92b852e9491bf3ef12327
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Nov 15 16:25:53 2011 -0500

    Stamped upgrade for full circ count view fix
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 1b9305e..3ff4d76 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -57,7 +57,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0646'); -- jamesrf/senator
+INSERT INTO config.upgrade_log (version) VALUES ('0649'); -- dbwells/tsbere/miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql b/Open-ILS/src/sql/Pg/upgrade/0649.schema.fix_full_circ_count_view.sql
similarity index 86%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
rename to Open-ILS/src/sql/Pg/upgrade/0649.schema.fix_full_circ_count_view.sql
index 2107adc..98b789f 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0649.schema.fix_full_circ_count_view.sql
@@ -1,3 +1,7 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0649');
+
 CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
  SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(DISTINCT circ.id), 0::bigint) + COALESCE(count(DISTINCT acirc.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
@@ -5,3 +9,6 @@ CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
    LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id
    LEFT JOIN "action".aged_circulation acirc ON acirc.target_copy = cp.id
   GROUP BY cp.id, c.circ_count;
+
+COMMIT;
+

commit 94ad57aaa69534d0541406de6afa721a7f4ec9d4
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Sep 29 10:44:26 2011 -0400

    Use DISTINCT in counts to avoid dupes
    
    Otherwise you get:
    Legacy count + 2(normal count)(aged count)
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql
index 3643631..cb7eec5 100644
--- a/Open-ILS/src/sql/Pg/extend-reporter.sql
+++ b/Open-ILS/src/sql/Pg/extend-reporter.sql
@@ -26,7 +26,7 @@ CREATE TABLE extend_reporter.legacy_circ_count (
 );
 
 CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
- SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
+ SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(DISTINCT circ.id), 0::bigint) + COALESCE(count(DISTINCT acirc.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
    LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
    LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
index eb558c3..2107adc 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
@@ -1,5 +1,5 @@
 CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
- SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
+ SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(DISTINCT circ.id), 0::bigint) + COALESCE(count(DISTINCT acirc.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
    LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
    LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id

commit a3b8fb1d6057adacf9136690bfc1143c3b1dac9e
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Thu Sep 29 09:23:49 2011 -0400

    Full Circ Count View Amplifies Legacy Circs
    
    The current extend_reported.full_circ_count sums the legacy circ count
    column, but this results in amplifying the count by the number of current
    circs in the system.  This commit adds the legacy count to the GROUP BY
    instead of summing it.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql
index 6a13568..3643631 100644
--- a/Open-ILS/src/sql/Pg/extend-reporter.sql
+++ b/Open-ILS/src/sql/Pg/extend-reporter.sql
@@ -26,12 +26,12 @@ CREATE TABLE extend_reporter.legacy_circ_count (
 );
 
 CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
- SELECT cp.id, COALESCE(sum(c.circ_count), 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
+ SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
    FROM asset."copy" cp
    LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
    LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id
    LEFT JOIN "action".aged_circulation acirc ON acirc.target_copy = cp.id
-  GROUP BY cp.id;
+  GROUP BY cp.id, c.circ_count;
 
 CREATE OR REPLACE VIEW extend_reporter.global_bibs_by_holding_update AS
   SELECT DISTINCT ON (id) id, holding_update, update_type
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
new file mode 100644
index 0000000..eb558c3
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.fix_full_circ_count_view.sql
@@ -0,0 +1,7 @@
+CREATE OR REPLACE VIEW extend_reporter.full_circ_count AS
+ SELECT cp.id, COALESCE(c.circ_count, 0::bigint) + COALESCE(count(circ.id), 0::bigint) + COALESCE(count(acirc.id), 0::bigint) AS circ_count
+   FROM asset."copy" cp
+   LEFT JOIN extend_reporter.legacy_circ_count c USING (id)
+   LEFT JOIN "action".circulation circ ON circ.target_copy = cp.id
+   LEFT JOIN "action".aged_circulation acirc ON acirc.target_copy = cp.id
+  GROUP BY cp.id, c.circ_count;

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

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/extend-reporter.sql            |    4 ++--
 .../0649.schema.fix_full_circ_count_view.sql       |   14 ++++++++++++++
 3 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0649.schema.fix_full_circ_count_view.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list