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>
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);