[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 65f6e201532f1f75ffad0e95af137ca54c189a0c

Evergreen Git git at git.evergreen-ils.org
Tue Nov 15 16:17:14 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_1 has been updated
       via  65f6e201532f1f75ffad0e95af137ca54c189a0c (commit)
       via  778ef89f5ab6ffdf8c250f2a6211203519fd3533 (commit)
       via  ee338f4a96ac14c37e694c0168bfdafc3aaf7b1a (commit)
      from  77c1fa3a13d58c0850a84308d02fa058e1d3e1ba (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 65f6e201532f1f75ffad0e95af137ca54c189a0c
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Nov 15 16:24:06 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 c27de3b..3467bb5 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 ('0648'); -- phasefx/miker
+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 778ef89f5ab6ffdf8c250f2a6211203519fd3533
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 ee338f4a96ac14c37e694c0168bfdafc3aaf7b1a
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