Changeset 9440

Show
Ignore:
Timestamp:
04/23/08 08:23:10 (3 weeks ago)
Author:
miker
Message:

adding helper views for overdue, running and pending reports

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Open-ILS/src/sql/Pg/reporter-schema.sql

    r8016 r9440  
    214214        AND due_date < now(); 
    215215 
     216CREATE OR REPLACE VIEW reporter.overdue_reports AS 
     217 SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time 
     218   FROM reporter.schedule s 
     219   JOIN reporter.report r ON r.id = s.report 
     220   JOIN actor.usr u ON s.runner = u.id 
     221   JOIN actor.card c ON c.id = u.card 
     222  WHERE s.start_time IS NULL AND s.run_time < now(); 
     223 
     224CREATE OR REPLACE VIEW reporter.pending_reports AS 
     225 SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time 
     226   FROM reporter.schedule s 
     227   JOIN reporter.report r ON r.id = s.report 
     228   JOIN actor.usr u ON s.runner = u.id 
     229   JOIN actor.card c ON c.id = u.card 
     230  WHERE s.start_time IS NULL; 
     231 
     232CREATE OR REPLACE VIEW reporter.currently_running AS 
     233 SELECT s.id, c.barcode AS runner_barcode, r.name, s.run_time, s.run_time - now() AS scheduled_wait_time 
     234   FROM reporter.schedule s 
     235   JOIN reporter.report r ON r.id = s.report 
     236   JOIN actor.usr u ON s.runner = u.id 
     237   JOIN actor.card c ON c.id = u.card 
     238  WHERE s.start_time IS NOT NULL AND s.complete_time IS NULL; 
     239 
    216240COMMIT; 
    217241