Function for storing daily capacity data
authorDoug Kyle <dkyle@grpl.org>
Mon, 14 Apr 2014 13:58:11 +0000 (09:58 -0400)
committerDoug Kyle <dkyle@grpl.org>
Mon, 14 Apr 2014 13:58:11 +0000 (09:58 -0400)
Function intended to be run from cron, cap store data for monitoring and reporting on floating collecttions.

Signed-off-by: Doug Kyle <dkyle@grpl.org>
Open-ILS/src/sql/Pg/smart_float.sql

index eaa08d3..e64dc88 100644 (file)
@@ -260,5 +260,16 @@ BEGIN
         END IF;
 END;
 
+-- !!!  smart_float.add2_cap_store  !!!
+CREATE OR REPLACE FUNCTION smart_float.add2_cap_store()
+ -- run nightly to populate cap_store table
+ RETURNS void
+ LANGUAGE plpgsql
+AS $function$
+BEGIN
+  insert into smart_float.cap_store (branch,taken,allowed,open,percent_capacity,name,shelf_loc,cap_date) select sfcap.*,date(now()) from grpl.smart_float_capacities() sfcap;
+END;
+$function$;
+
 -- !!! need some new indexes
 create index concurrently cp_location_idx on asset.copy (location);