stats work; adding columns for stat tracking
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Sep 2005 14:33:50 +0000 (14:33 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Sep 2005 14:33:50 +0000 (14:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1790 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
Open-ILS/src/sql/Pg/090.schema.action.sql
Open-ILS/src/sql/Pg/stats/circ_stats.sql

index f41038e..18288a7 100644 (file)
@@ -45,7 +45,10 @@ __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib
                                     duration duration_rule renewal_remaining
                                     recuring_fine_rule recuring_fine stop_fines
                                     max_fine max_fine_rule fine_interval
-                                    stop_fines xact_finish due_date renewal/);
+                                    stop_fines xact_finish due_date opac_renewal
+                                    checkin_staff circ_staff circ_lib checkin_lib
+                                    stop_fines_time checkin_time desk_renewal
+                                    phone_renewal/);
 
 #-------------------------------------------------------------------------------
 
@@ -57,7 +60,10 @@ __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib
                                     duration duration_rule renewal_remaining
                                     recuring_fine_rule recuring_fine stop_fines
                                     max_fine max_fine_rule fine_interval
-                                    stop_fines xact_finish due_date renewal/);
+                                    stop_fines xact_finish due_date opac_renewal
+                                    checkin_staff circ_staff circ_lib checkin_lib
+                                    stop_fines_time checkin_time desk_renewal
+                                    phone_renewal/);
 
 #-------------------------------------------------------------------------------
 
@@ -69,7 +75,8 @@ __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time
                                     prev_check_time expire_time requestor usr
                                     hold_type holdable_formats target
                                     phone_notify email_notify selection_depth
-                                    pickup_lib current_copy/);
+                                    pickup_lib current_copy request_lib
+                                    fulfillment_staff fulfillment_lib/);
 
 #-------------------------------------------------------------------------------
 
index 4ea8be8..43889e9 100644 (file)
@@ -57,13 +57,19 @@ CREATE TRIGGER action_survey_response_answer_date_fixup_tgr
 CREATE TABLE action.circulation (
        target_copy             BIGINT                          NOT NULL, -- asset.copy.id
        circ_lib                INT                             NOT NULL, -- actor.org_unit.id
+       circ_staff              INT                             NOT NULL, -- actor.usr.id
+       checkin_staff           INT,                                      -- actor.usr.id
        renewal_remaining       INT                             NOT NULL, -- derived from "circ duration" rule
-       renewal                 BOOL                            NOT NULL DEFAULT FALSE,
        due_date                TIMESTAMP WITH TIME ZONE        NOT NULL,
+       stop_fines_time         TIMESTAMP WITH TIME ZONE,
+       checkin_time            TIMESTAMP WITH TIME ZONE,
        duration                INTERVAL                        NOT NULL, -- derived from "circ duration" rule
        fine_interval           INTERVAL                        NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule
        recuring_fine           NUMERIC(6,2)                    NOT NULL, -- derived from "circ fine" rule
        max_fine                NUMERIC(6,2)                    NOT NULL, -- derived from "max fine" rule
+       phone_renewal           BOOL                            NOT NULL DEFAULT FALSE,
+       desk_renewal            BOOL                            NOT NULL DEFAULT FALSE,
+       opac_renewal            BOOL                            NOT NULL DEFAULT FALSE,
        duration_rule           TEXT                            NOT NULL, -- name of "circ duration" rule
        recuring_fine_rule      TEXT                            NOT NULL, -- name of "circ fine" rule
        max_fine_rule           TEXT                            NOT NULL, -- name of "max fine" rule
@@ -74,10 +80,7 @@ CREATE INDEX circ_open_xacts_idx ON action.circulation (usr) WHERE xact_finish I
 CREATE OR REPLACE VIEW action.open_circulation AS
        SELECT  *
          FROM  action.circulation
-         WHERE xact_finish IS NULL
-               AND (   stop_fines IS NULL OR
-                       stop_fines NOT IN ('CHECKIN','RENEW')
-               )
+         WHERE checkin_time IS NULL
          ORDER BY due_date;
                
 
index 9474548..7439bb2 100644 (file)
@@ -61,9 +61,9 @@ CREATE TRIGGER circ_stats_copy_dim_id_trigger
 
 
 CREATE TABLE circ_stats.circ_dim (
-       circ_lib                INT                             NOT NULL,
-       circ_staff              INT,
        circ_opac_renewal       BOOL,
+       circ_desk_renewal       BOOL,
+       circ_phone_renewal      BOOL,
        circ_self_checkout      BOOL,
        circ_recuring_fine      NUMERIC(6,2)                    NOT NULL,
        circ_max_fine           NUMERIC(6,2)                    NOT NULL,
@@ -85,6 +85,8 @@ CREATE TRIGGER circ_stats_circ_dim_id_trigger
 CREATE TABLE circ_stats.checkout_fact (
        -- circulation info
        circ_id                 BIGINT                          PRIMARY KEY,
+       circ_lib                INT                             NOT NULL,
+       circ_staff              INT,
        circ_timestamp          TIMESTAMP WITH TIME ZONE        NOT NULL,
        circ_dim                TEXT                            NOT NULL REFERECES circ_stats.circ_dim (id),
 
@@ -106,6 +108,8 @@ CREATE INDEX circ_stats_checkout_fact_bib_dim_idx   ON circ_stats.checkout_fact (b
 CREATE TABLE circ_stats.renewal_fact (
        -- circulation info
        circ_id                 BIGINT                          PRIMARY KEY,
+       circ_lib                INT                             NOT NULL,
+       circ_staff              INT,
        circ_timestamp          TIMESTAMP WITH TIME ZONE        NOT NULL,
        circ_dim                TEXT                            NOT NULL REFERECES circ_stats.circ_dim (id),
 
@@ -127,6 +131,8 @@ CREATE INDEX circ_stats_renewal_fact_bib_dim_idx    ON circ_stats.renewal_fact (bib
 CREATE TABLE circ_stats.checkin_fact (
        -- circulation info
        circ_id                 BIGINT                          PRIMARY KEY,
+       circ_lib                INT                             NOT NULL,
+       circ_staff              INT,
        circ_timestamp          TIMESTAMP WITH TIME ZONE        NOT NULL,
        circ_dim                TEXT                            NOT NULL REFERECES circ_stats.circ_dim (id),