From 1d662a5f69fa83970bdd899452d92311b146ee6e Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 27 Dec 2005 19:10:32 +0000 Subject: [PATCH] added cirulation view git-svn-id: svn://svn.open-ils.org/ILS/trunk@2537 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/090.schema.action.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index cab9cd82ac..f83c605645 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -90,6 +90,21 @@ CREATE OR REPLACE VIEW action.billable_cirulations AS FROM action.circulation WHERE xact_finish IS NULL; +CREATE VIEW stats.fleshed_circulation AS + SELECT c.*, + CAST(c.xact_start AS DATE) AS start_date_day, + CAST(c.xact_finish AS DATE) AS finish_date_day, + DATE_TRUNC('hour', c.xact_start) AS start_date_hour, + DATE_TRUNC('hour', c.xact_finish) AS finish_date_hour, + cp.call_number_label, + cp.owning_lib, + cp.item_lang, + cp.item_type, + cp.item_form + FROM "action".circulation c + JOIN stats.fleshed_copy cp ON (cp.id = c.target_copy); + + CREATE OR REPLACE FUNCTION action.circulation_claims_returned () RETURNS TRIGGER AS $$ BEGIN IF OLD.stop_fines IS NULL OR OLD.stop_fines <> NEW.stop_fines THEN -- 2.43.2